WIP: add email-based account merge flow to ShareLaTeX

This commit is contained in:
Shane Kilkelly 2018-09-10 10:58:50 +01:00
parent b16cffe587
commit ba221a1135
2 changed files with 37 additions and 1 deletions

View file

@ -40,6 +40,14 @@ The #{settings.appName} Team - #{settings.siteUrl}
templates = {}
templates.accountMergeToOverleafAddress = CTAEmailTemplate({
subject: () -> "Confirm Account Merge - #{settings.appName}"
title: () -> "Confirm Account Merge"
message: () -> "To merge your ShareLaTeX and Overleaf accounts, click the link below."
ctaText: () -> "Confirm Account Merge"
ctaURL: (opts) -> opts.tokenLinkUrl
})
templates.registered = CTAEmailTemplate({
subject: () -> "Activate your #{settings.appName} Account"
message: (opts) -> """

View file

@ -1,5 +1,33 @@
define [
"base"
], (App) ->
App.controller "AccountMergeCheckerController", ($scope) ->
# For account-merge-module
App.controller "SharelatexAccountMergeCheckerController", ($scope, $http) ->
$scope.hasOlAccount = null
$scope.olEmail = ""
$scope.errorCode = null
$scope.success = null
console.log ">>>> here"
$scope.submitEmail = () ->
return if !$scope.olEmail
data = {
overleafEmail: $scope.olEmail
_csrf: window.csrfToken
}
console.log ">>>> sending email", data
$scope.errorCode = null
$http.post("/account-merge/email/overleaf", data)
.then (resp) ->
console.log ">>>> success", resp
$scope.errorCode = null
$scope.success = true
.catch (resp) ->
console.log ">>>> error", resp
$scope.errorCode = resp?.data?.errorCode || 'default_error'
$scope.success = false
# For integration-module
App.controller "OverleafAccountMergeCheckerController", ($scope) ->
$scope.hasOlAccount = null