From 5fe28dbbf98a4abb7c8a6605034a8c62b1fa5ea0 Mon Sep 17 00:00:00 2001 From: Krzysztof Daniel Date: Mon, 17 Aug 2015 21:04:55 +0200 Subject: [PATCH] Add support for T&C. When configured in config.json, they appear on the registration and login pages. --- client/views/base.jade | 372 ++++++++++++++++++ client/views/facebook_login_failed.jade | 22 ++ client/views/facebook_login_form.jade | 41 ++ client/views/forgot.jade | 44 +++ client/views/forgot_change.jade | 47 +++ client/views/forgot_change_failed.jade | 22 ++ client/views/forgot_complete.jade | 24 ++ client/views/forgot_email_sent.jade | 21 + client/views/google_login_failed.jade | 22 ++ client/views/google_login_form.jade | 42 ++ client/views/id_site_verification_failed.jade | 22 ++ client/views/login.jade | 99 +++++ client/views/register.jade | 82 ++++ client/views/unauthorized.jade | 19 + client/views/verification_complete.jade | 24 ++ client/views/verification_email_sent.jade | 22 ++ client/views/verification_failed.jade | 22 ++ client/views/verification_resend.jade | 45 +++ server/user-provider.js | 8 +- 19 files changed, 999 insertions(+), 1 deletion(-) create mode 100644 client/views/base.jade create mode 100644 client/views/facebook_login_failed.jade create mode 100644 client/views/facebook_login_form.jade create mode 100644 client/views/forgot.jade create mode 100644 client/views/forgot_change.jade create mode 100644 client/views/forgot_change_failed.jade create mode 100644 client/views/forgot_complete.jade create mode 100644 client/views/forgot_email_sent.jade create mode 100644 client/views/google_login_failed.jade create mode 100644 client/views/google_login_form.jade create mode 100644 client/views/id_site_verification_failed.jade create mode 100644 client/views/login.jade create mode 100644 client/views/register.jade create mode 100644 client/views/unauthorized.jade create mode 100644 client/views/verification_complete.jade create mode 100644 client/views/verification_email_sent.jade create mode 100644 client/views/verification_failed.jade create mode 100644 client/views/verification_resend.jade diff --git a/client/views/base.jade b/client/views/base.jade new file mode 100644 index 0000000..4ee8b9b --- /dev/null +++ b/client/views/base.jade @@ -0,0 +1,372 @@ +block vars +doctype html +| +| +| +| +html(class='no-js', lang='en') + | + head + meta(charset='utf-8') + title #{title} + meta(content='#{description}', name='description') + meta(content='width=device-width', name='viewport') + link(href='//fonts.googleapis.com/css?family=Open+Sans:300italic,300,400italic,400,600italic,600,700italic,700,800italic,800', rel='stylesheet', type='text/css') + link(href='//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css', rel='stylesheet') + style. + html, + body { + height: 100%; + } + + @media (max-width: 767px) { + html, + body { + padding: 0 4px; + } + } + + body { + margin-left: auto; + margin-right: auto; + } + + body, + div, + p, + a, + label { + font-family: "Open Sans"; + font-size: 14px; + font-weight: 400; + color: #484848; + } + + a { + color: #0072dd; + } + + p { + line-height: 21px; + } + + .container { + max-width: 620px; + } + + .logo { + margin: 34px auto 25px auto; + display: block; + } + + .btn-sp-green { + height: 45px; + line-height: 22.5px; + padding: 0 40px; + color: #fff; + font-size: 17px; + background: -webkit-linear-gradient(#42c41a 50%, #2dbd00 50%); + background: linear-gradient(#42c41a 50%, #2dbd00 50%); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#2dbd00, endColorstr=#42c41a); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#2dbd00, endColorstr=#42c41a)"; + } + + .btn-sp-green:hover, + .btn-sp-green:focus { + color: #fff; + background: -webkit-linear-gradient(#43cd1a 50%, #2ec700 50%); + background: linear-gradient(#43cd1a 50%, #2ec700 50%); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#2ec700, endColorstr=#43cd1a); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#2ec700, endColorstr=#43cd1a)"; + } + + .btn-social { + height: 37px; + line-height: 18.5px; + color: #fff; + font-size: 16px; + border-radius: 3px; + } + + .btn-social:hover, + .btn-social:focus { + color: #fff; + } + + .btn-facebook { + background: -webkit-linear-gradient(#4c6fc5 50%, #3d63c0 50%); + background: linear-gradient(#4c6fc5 50%, #3d63c0 50%); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#3d63c0, endColorstr=#4c6fc5); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#3d63c0, endColorstr=#4c6fc5)"; + } + + .btn-facebook:hover, + .btn-facebook:focus { + color: #fff; + background: -webkit-linear-gradient(#4773de 50%, #3767db 50%); + background: linear-gradient(#4773de 50%, #3767db 50%); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#3767db, endColorstr=#4773de); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#3767db, endColorstr=#4773de)"; + } + + .btn-google { + background: -webkit-linear-gradient(#e05b4b 50%, #dd4b39 50%); + background: linear-gradient(#e05b4b 50%, #dd4b39 50%); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#dd4b39, endColorstr=#e05b4b); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#dd4b39, endColorstr=#e05b4b)"; + } + + .btn-google:hover, + .btn-google:focus { + color: #fff; + background: -webkit-linear-gradient(#ea604e 50%, #e8503c 50%); + background: linear-gradient(#ea604e 50%, #e8503c 50%); + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#e8503c, endColorstr=#ea604e); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#e8503c, endColorstr=#ea604e)"; + } + + .btn-register { + font-size: 16px; + } + + .form-control { + font-size: 15px; + box-shadow: none; + } + + .form-control::-webkit-input-placeholder { + color: #aaadb0; + } + + .form-control::-moz-placeholder { + color: #aaadb0; + } + + .form-control:-ms-input-placeholder { + color: #aaadb0; + } + + .form-control::placeholder { + color: #aaadb0; + } + + .form-control:focus { + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px rgba(0, 132, 255, 0.4); + } + + .view .header { + padding: 34px 0; + } + + .view .header, + .view .header a { + font-weight: 300; + font-size: 21px; + } + + .view input[type="text"], + .view input[type="password"] { + background-color: #f6f6f6; + height: 45px; + } + + .view a.forgot, + .view a.to-login { + float: right; + padding: 17px 0; + font-size: 13px; + } + + .view form button { + display: block; + float: right; + margin-bottom: 25px; + } + + .view form label { + height: 45px; + line-height: 45px; + } + + .box { + box-shadow: 0 0px 3px 1px rgba(0, 0, 0, 0.1); + border: 1px solid #cacaca; + border-radius: 3px; + padding: 0 30px; + } + + .sp-form .has-error, + .sp-form .has-error .help-block { + color: #ec3e3e; + font-weight: 600; + } + + .sp-form .has-error input[type="text"], + .sp-form .has-error input[type="password"] { + border-color: #ec3e3e; + } + + .sp-form .form-group { + margin-bottom: 21px; + } + + .sp-form input[type="text"], + .sp-form input[type="password"] { + position: relative; + } + + .sp-form .help-block { + font-size: 12px; + position: absolute; + top: 43px; + } + + .verify-view .box { + padding-bottom: 30px; + } + + .verify-view .box .header { + padding-bottom: 20px; + } + + .unverified-view .box { + padding-bottom: 30px; + } + + .unverified-view .box .header { + padding-bottom: 25px; + } + + .login-view .box { + background-color: #f6f6f6; + padding: 0; + } + + .login-view label { + margin-bottom: 7px; + } + + .login-view .header p { + margin-top: 2em; + } + + .login-view .email-password-area { + background-color: white; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + } + + @media (min-width: 767px) { + .login-view .email-password-area { + padding: 0 30px; + } + } + + .login-view .email-password-area label { + height: 14px; + line-height: 14px; + } + + .login-view .email-password-area input[type='checkbox'] { + visibility: hidden; + } + + .login-view .email-password-area input[type='checkbox'] + label { + position: relative; + padding-left: 8px; + line-height: 16px; + font-size: 13px; + } + + .login-view .email-password-area input[type='checkbox'] + label:after { + position: absolute; + left: -16px; + width: 16px; + height: 16px; + border: 1px solid #cacaca; + background-color: #f6f6f6; + content: ""; + } + + .login-view .email-password-area input[type='checkbox']:checked + label:after { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowRTVBQUVGMzJEODBFMjExODQ2N0NBMjk4MjdCNDBCNyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo0RTY4NUM4NURGNEYxMUUyQUE5QkExOTlGODU3RkFEOCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo0RTY4NUM4NERGNEYxMUUyQUE5QkExOTlGODU3RkFEOCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjQxNDQ4M0NEM0JERkUyMTE4MEYwQjNBRjIwMUNENzQxIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZDMEMxNjY2OUVCMUUyMTFBRjVDQkQ0QjE5MTNERDU2Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+3YY4qgAAALlJREFUeNpi/P//PwMlgImBQjDwBrCgCwQHB+NUfObMGT9mZuboe/fuheM0ABu4fv060/fv32cBNTNycHBE4nUBNs0/f/7cAWSeMzQ0rCA5DICaNwKj+qGRkVEFUYF47ty5GWfPns2EsjsYGRlFgM5OJzoQ//37t5eLi2sRMMDec3Jypn79+lVXX1//H9HRaGJisvr379/nuLm5lwKdP9vMzOwZyekAaEA3EF8G4hZCYcQ4mhcYAAIMAJGST/dDIpNQAAAAAElFTkSuQmCC); + background-position: -1px -1px; + } + + @media (min-width: 767px) { + .login-view .email-password-area.small { + border-right: 1px solid #cacaca; + } + + .login-view .email-password-area.small .group-email { + margin-bottom: 21px; + } + } + + @media (max-width: 767px) { + .login-view .email-password-area.small { + border-bottom: 1px solid #cacaca; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + } + + .login-view .email-password-area.large { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + } + + @media (min-width: 767px) { + .login-view .email-password-area.large { + padding: 0 50px; + } + + .login-view .email-password-area.large .group-email label, + .login-view .email-password-area.large .group-password label { + height: 45px; + line-height: 45px; + } + } + + .login-view .social-area { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + padding: 0 20px; + position: relative; + padding-bottom: 20px; + background-color: #f6f6f6; + } + + .login-view .social-area .header { + margin-bottom: -6px; + } + + @media (max-width: 767px) { + .login-view .social-area .header { + padding: 0px; + } + } + + .login-view .social-area button { + display: block; + width: 100%; + margin-bottom: 15px; + } + + .login, .register { display: table; } + .va-wrapper { display: table-cell; width: 100%; vertical-align: middle; } + .custom-container { display: table-row; height: 100%; } + + | + + block head + + body(class='#{bodytag}') + + block body + + script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js') + script(src='//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js') diff --git a/client/views/facebook_login_failed.jade b/client/views/facebook_login_failed.jade new file mode 100644 index 0000000..8df3ba0 --- /dev/null +++ b/client/views/facebook_login_failed.jade @@ -0,0 +1,22 @@ +extends base + +block vars + - var title = 'Facebook Login Failed' + - var description = "Your Facebook login attempt has failed!" + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Facebook Login Failed + p. + Your Facebook login attempt has failed. This might happen for + several reasons: your verification token might be expired, it + might be invalid, or we may just be having issues right now! + Please try again, and if you're still having problems, contact + the site administrator for help! diff --git a/client/views/facebook_login_form.jade b/client/views/facebook_login_form.jade new file mode 100644 index 0000000..24c1a68 --- /dev/null +++ b/client/views/facebook_login_form.jade @@ -0,0 +1,41 @@ +button.btn.btn-social.btn-facebook(onclick='facebookLogin()') Facebook +script(type='text/javascript'). + function facebookLogin() { + var FB = window.FB; + var facebookScopes = '#{app.get("stormpathSocial").facebook.scopes}'; + var scopes = []; + + if (facebookScopes.length) { + scopes = facebookScopes.join(','); + } else { + scopes = ''; + } + + FB.login(function(response) { + if (response.status === 'connected') { + var queryStr = window.location.search.replace('?', ''); + if (queryStr) { + window.location.replace('#{app.get("stormpathFacebookLoginUrl")}?' + queryStr + '&access_token=' + response.authResponse.accessToken); + } else { + window.location.replace('#{app.get("stormpathFacebookLoginUrl")}?access_token=' + response.authResponse.accessToken); + } + } + }, {scope: 'email' + (scopes ? ',' + scopes : '')}); + } + + window.fbAsyncInit = function() { + FB.init({ + appId : '#{app.get("stormpathSocial").facebook.appId}', + cookie : true, + xfbml : true, + version : 'v2.0' + }); + }; + + (function(d, s, id){ + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) {return;} + js = d.createElement(s); js.id = id; + js.src = "//connect.facebook.net/en_US/sdk.js"; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'facebook-jssdk')); diff --git a/client/views/forgot.jade b/client/views/forgot.jade new file mode 100644 index 0000000..8dd8e18 --- /dev/null +++ b/client/views/forgot.jade @@ -0,0 +1,44 @@ +extends base + +block vars + - var title = 'Forgot Your Password?' + - var description = 'Forgot your password? No worries!' + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Forgot your password? + p. + Enter your email address below to reset your password. You will + be sent an email which you will need to open to continue. You may + need to check your spam folder. + + if error + .alert.alert-danger.bad-login + p #{error} + + if formErrors + .alert.alert-danger.bad-login + each error in formErrors + p #{error} + + form.login-form.form-horizontal(method='post', role='form') + input(name='_csrf', type='hidden', value=csrfToken) + + .form-group.group-email + label.col-sm-4 Email + + div.col-sm-8 + input.form-control(placeholder='Email', required=true, name='email', type='text') + + div + button.login.btn.btn-login.btn-sp-green(type='submit') Submit + + if app.get('stormpathEnableLogin') + a.forgot(href="#{app.get('stormpathLoginUrl')}") Back to Log In diff --git a/client/views/forgot_change.jade b/client/views/forgot_change.jade new file mode 100644 index 0000000..7f15855 --- /dev/null +++ b/client/views/forgot_change.jade @@ -0,0 +1,47 @@ +extends base + +block vars + - var title = 'Change Your Password' + - var description = 'Change your password here.' + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Change Your Password + p. + Enter your new account password below. Once confirmed, + you'll be logged into your account and your new password will be + active. + + if error + .alert.alert-danger.bad-login + p #{error} + + if formErrors + .alert.alert-danger.bad-login + each error in formErrors + p #{error} + + form.login-form.form-horizontal(method='post', role='form') + input(name='_csrf', type='hidden', value=csrfToken) + + .form-group.group-password + label.col-sm-4 Password + + div.col-sm-8 + input.form-control(placeholder='Password', required=true, name='password', type='password') + + .form-group.group-password + label.col-sm-4 Password (again) + + div.col-sm-8 + input.form-control(placeholder='Password (again)', required=true, name='passwordAgain', type='password') + + div + button.login.btn.btn-login.btn-sp-green(type='submit') Submit diff --git a/client/views/forgot_change_failed.jade b/client/views/forgot_change_failed.jade new file mode 100644 index 0000000..905867a --- /dev/null +++ b/client/views/forgot_change_failed.jade @@ -0,0 +1,22 @@ +extends base + +block vars + - var title = 'Password Reset Failed' + - var description = "Your password reset attempt has failed!" + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Password Reset Failed + p. + Your password reset attempt has failed. This might happen for + several reasons: your reset token might be expired, it might + have already been used, or we may just be having issues right + now! Please try again, and if you're still having + problems, contact the site administrator for help! diff --git a/client/views/forgot_complete.jade b/client/views/forgot_complete.jade new file mode 100644 index 0000000..0b774b4 --- /dev/null +++ b/client/views/forgot_complete.jade @@ -0,0 +1,24 @@ +extends base + +block vars + - var title = 'Password Change Complete' + - var description = 'You have successfully changed your password!' + - var bodytag = 'login' + +block head + meta(http-equiv='refresh' content="5; url=#{app.get('stormpathRedirectUrl')}") + + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Password Change Complete! + p. + Your password has been changed, and you have been logged into + your account. You will be redirected back to the site in 5 + seconds. diff --git a/client/views/forgot_email_sent.jade b/client/views/forgot_email_sent.jade new file mode 100644 index 0000000..2625af0 --- /dev/null +++ b/client/views/forgot_email_sent.jade @@ -0,0 +1,21 @@ +extends base + +block vars + - var title = 'Password Reset Email Sent' + - var description = 'Your password reset email has been sent!' + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Your password reset email has been sent! + p. + We have sent a password reset email to the email + address you have provided. + p. + Please check your inbox to continue. diff --git a/client/views/google_login_failed.jade b/client/views/google_login_failed.jade new file mode 100644 index 0000000..7f032f4 --- /dev/null +++ b/client/views/google_login_failed.jade @@ -0,0 +1,22 @@ +extends base + +block vars + - var title = 'Google Login Failed' + - var description = "Your Google login attempt has failed!" + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Google Login Failed + p. + Your Google login attempt has failed. This might happen for + several reasons: your verification token might be expired, it + might be invalid, or we may just be having issues right now! + Please try again, and if you're still having problems, contact + the site administrator for help! diff --git a/client/views/google_login_form.jade b/client/views/google_login_form.jade new file mode 100644 index 0000000..527464a --- /dev/null +++ b/client/views/google_login_form.jade @@ -0,0 +1,42 @@ +button.btn.btn-social.btn-google(onclick='googleLogin()') Google +script(type='text/javascript'). + /** + * Get the value of a querystring + * @param {String} field The field to get the value of + * @param {String} url The URL to get the value from (optional) + * @return {String} The field value + */ + function getQueryString(field, url) { + var href = url ? url : window.location.href; + var reg = new RegExp('[?&]' + field + '=([^&#]*)', 'i'); + var string = reg.exec(href); + return string ? string[1] : null; + } + + function googleLogin() { + var clientId = '#{app.get("stormpathSocial").google.clientId}'; + var googleScopes = '#{app.get("stormpathSocial").google.scopes}'; + var hd = '#{app.get("stormpathSocial").google.hd}'; + var scopes = ''; + var next = getQueryString('next').replace(/^\s+|\s+$/g, ''); + + if (googleScopes.length) { + scopes = '+' + googleScopes.split(',').join('+'); + } + + var finalUrl = 'https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=' + + clientId + + '&scope=email' + scopes + + '&include_granted_scopes=true&redirect_uri=' + + '#{url}#{app.get("stormpathGoogleLoginUrl")}'; + + if (hd) { + finalUrl = finalUrl + '&hd=' + hd; + } + + if (next) { + finalUrl = finalUrl + '&state=' + next; + } + + window.location.replace(finalUrl); + } diff --git a/client/views/id_site_verification_failed.jade b/client/views/id_site_verification_failed.jade new file mode 100644 index 0000000..f65dc37 --- /dev/null +++ b/client/views/id_site_verification_failed.jade @@ -0,0 +1,22 @@ +extends base + +block vars + - var title = 'Verification Failed' + - var description = "Your verification has failed!" + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Verification Failed + p. + Your account verification has failed. This might happen for + several reasons: your verification token might be expired, it + might have already been used, or we may just be having issues + right now! Please try again, and if you're still having + problems, contact the site administrator for help! diff --git a/client/views/login.jade b/client/views/login.jade new file mode 100644 index 0000000..e84a24b --- /dev/null +++ b/client/views/login.jade @@ -0,0 +1,99 @@ +extends base + +block vars + - var title = 'Log In' + - var description = 'Log into your account!' + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + if app.get('stormpathEnableFacebook') || app.get('stormpathEnableGoogle') + - var cls = 'small col-sm-8' + else + - var cls = 'large col-sm-12' + + div(class='email-password-area col-xs-12 #{cls}') + .header + if app.get('stormpathEnableRegistration') + span. + Log In or Create Account + else + span. + Log In + + if error + .alert.alert-danger.bad-login + p #{error} + + if formErrors + .alert.alert-danger.bad-login + each error in formErrors + p #{error.error} + + form.login-form.form-horizontal(method='post', role='form') + input(name='_csrf', type='hidden', value=csrfToken) + + .form-group.group-email + if app.get('stormpathEnableFacebook') || app.get('stormpathEnableGoogle') + - var cls = 'col-sm-12' + else + - var cls = 'col-sm-4' + + if app.get('stormpathEnableUsername') + label(class='#{cls}') Username or Email + else + label(class='#{cls}') Email + + if app.get('stormpathEnableFacebook') || app.get('stormpathEnableGoogle') + - var cls = 'col-sm-12' + else + - var cls = 'col-sm-8' + + div(class='#{cls}') + - var value = form.data ? form.data.login : ''; + if app.get('stormpathEnableUsername') + input.form-control(autofocus='true', placeholder='Username or Email', required=true, name='login', type='text', value=value) + else + input.form-control(autofocus='true', placeholder='Email', required=true, name='login', type='text', value=value) + + if app.get('stormpathEnableFacebook') || app.get('stormpathEnableGoogle') + - var cls = 'col-sm-12' + else + - var cls = 'col-sm-4' + + .form-group.group-password + label(class='#{cls}') Password + + if app.get('stormpathEnableFacebook') || app.get('stormpathEnableGoogle') + - var cls = 'col-sm-12' + else + - var cls = 'col-sm-8' + + div(class='#{cls}') + input.form-control(placeholder='Password', required=true, type='password', name='password') + + div + button.login.btn.btn-login.btn-sp-green(type='submit') Log In + + if app.get('stormpathEnableFacebook') || app.get('stormpathEnableGoogle') + .social-area.col-xs-12.col-sm-4 + .header   + label Easy 1-click login: + if app.get('stormpathEnableFacebook') + include facebook_login_form.jade + if app.get('stormpathEnableGoogle') + include google_login_form.jade + if toc + .row + .col-sm-12.small(style="margin: 0 auto;") By logging on and using this service, you accept  + a.small(href="#{toc}" target="_blank") Terms & Conditions + |  (last update #{tocupdate}). + if app.get('stormpathEnableAccountVerification') + a.forgot(style="float:left", href="#{app.get('stormpathResendAccountVerificationEmailUrl')}") Resend Verification Email? + if app.get('stormpathEnableForgotPassword') + a.forgot(style="float:right", href="#{app.get('stormpathForgotPasswordUrl')}") Forgot Password? + + \ No newline at end of file diff --git a/client/views/register.jade b/client/views/register.jade new file mode 100644 index 0000000..48f982f --- /dev/null +++ b/client/views/register.jade @@ -0,0 +1,82 @@ +extends base +block vars + - var title = 'Create an Account' + - var description = 'Create a new account.' + - var bodytag = 'register' + +block body + .container.custom-container + .va-wrapper + .view.registration-view.container + .box.row + .col-sm-12 + .header + span Create Account + + if error + .alert.alert-danger + p #{error} + + if formErrors + .alert.alert-danger + each error in formErrors + p #{error.error} + + form.registration-form.form-horizontal.sp-form(method='post', role='form') + input(name='_csrf', type='hidden', value=csrfToken) + + if app.get('stormpathEnableUsername') + .form-group.group-username(form-group='true') + label.col-sm-4 Username + .col-sm-8 + - var value = form.data ? form.data.username : ''; + input.form-control(placeholder='Username', name='username', value=value, required=app.get('stormpathRequireUsername') ? true : false, type='text') + + if app.get('stormpathEnableGivenName') + .form-group.group-first-name(form-group='true') + label.col-sm-4 First Name + .col-sm-8 + - var value = form.data ? form.data.givenName : ''; + input.form-control(placeholder='First Name', name='givenName', value=value, required=app.get('stormpathRequireGivenName') ? true : false, type='text') + + if app.get('stormpathEnableMiddleName') + .form-group.group-middle-name(form-group='true') + label.col-sm-4 Middle Name + .col-sm-8 + - var value = form.data ? form.data.middleName : ''; + input.form-control(placeholder='Middle Name', name='middleName', value=value, required=app.get('stormpathRequireMiddleName') ? true : false, type='text') + + if app.get('stormpathEnableSurname') + .form-group.group-last-name(form-group='true') + label.col-sm-4 Last Name + .col-sm-8 + - var value = form.data ? form.data.surname : ''; + input.form-control(placeholder='Last Name', name='surname', value=value, required=app.get('stormpathRequireSurname') ? true : false, type='text') + + .form-group.group-email(form-group='true') + label.col-sm-4 Email + .col-sm-8 + - var value = form.data ? form.data.email : ''; + input.form-control(placeholder='Email', name='email', value=value, required='true', type='text') + + .form-group.group-password(form-group='true') + label.col-sm-4 Password + .col-sm-8 + input.form-control(placeholder='Password', name='password', required='true', type='password') + + if app.get('stormpathEnableConfirmPassword') + .form-group.group-confirm-password(form-group='true') + label.col-sm-4 Confirm Password + .col-sm-8 + input.form-control(placeholder='Confirm Password', name='confirmPassword', required='true', type='password') + + if toc + .form-group.group-accept-toc(form-group='true') + label.col-sm-8 I hereby accept  + a(href="#{toc}" target="_blank") Terms & Conditions + .col-sm-4 + input.form-control(name='acceptTOC', required='true', type='checkbox') + + button.btn.btn-register.btn-sp-green(type='submit') Create Account + + a.to-login(href=app.get('stormpathLoginUrl')) Back to Log In diff --git a/client/views/unauthorized.jade b/client/views/unauthorized.jade new file mode 100644 index 0000000..77b2f84 --- /dev/null +++ b/client/views/unauthorized.jade @@ -0,0 +1,19 @@ +extends base + +block vars + - var title = 'Unauthorized' + - var description = "You aren't authorized to view this page!" + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Unauthorized + p. + You are not authorized to view this page. Please check with the + site administrator for help! diff --git a/client/views/verification_complete.jade b/client/views/verification_complete.jade new file mode 100644 index 0000000..f43ac4b --- /dev/null +++ b/client/views/verification_complete.jade @@ -0,0 +1,24 @@ +extends base + +block vars + - var title = 'Account Verification Complete' + - var description = 'You have successfully verified your account!' + - var bodytag = 'login' + +block head + meta(http-equiv='refresh' content="5; url=#{app.get('stormpathRedirectUrl')}") + + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Account Verification Complete! + p. + Your account has been verified, and you have been logged into + your account. You will be redirected back to the site in 5 + seconds. diff --git a/client/views/verification_email_sent.jade b/client/views/verification_email_sent.jade new file mode 100644 index 0000000..32a1a32 --- /dev/null +++ b/client/views/verification_email_sent.jade @@ -0,0 +1,22 @@ +extends base + +block vars + - var title = 'Account Verification Email Sent' + - var description = 'Your account verification email has been sent!' + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Your account verification email has been sent! + p. + Before you can log into your account, you need to activate your + account by clicking the link we sent to you at your email + address: #{email}. + p. + Please check your inbox to continue. diff --git a/client/views/verification_failed.jade b/client/views/verification_failed.jade new file mode 100644 index 0000000..0c06022 --- /dev/null +++ b/client/views/verification_failed.jade @@ -0,0 +1,22 @@ +extends base + +block vars + - var title = 'Verification Failed' + - var description = "Your verification token is invalid!" + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Verification Failed + p. + Your account verification has failed. This might happen for + several reasons: your verification token might be expired, it + might have already been used, or we may just be having issues + right now! Please try again, and if you're still having + problems, contact the site administrator for help! diff --git a/client/views/verification_resend.jade b/client/views/verification_resend.jade new file mode 100644 index 0000000..06acdaf --- /dev/null +++ b/client/views/verification_resend.jade @@ -0,0 +1,45 @@ +extends base + +block vars + - var title = 'Resend Account Verification Email?' + - var description = 'Didn\'t receive your account verification email? No worries!' + - var bodytag = 'login' + +block body + .container.custom-container + .va-wrapper + .view.login-view.container + .box.row + .email-password-area.col-xs-12.large.col-sm-12 + .header + span. + Didn't receive your account verification email? + p. + Enter your email address below and we'll resend your account + verification email. You will be sent an email which you will + need to open to continue. You may need to check your spam + folder. + + if error + .alert.alert-danger.bad-login + p #{error} + + if formErrors + .alert.alert-danger.bad-login + each error in formErrors + p #{error} + + form.login-form.form-horizontal(method='post', role='form') + input(name='_csrf', type='hidden', value=csrfToken) + + .form-group.group-email + label.col-sm-4 Email + + div.col-sm-8 + input.form-control(placeholder='Email', required=true, name='email', type='text') + + div + button.login.btn.btn-login.btn-sp-green(type='submit') Submit + + if app.get('stormpathEnableLogin') + a.forgot(href="#{app.get('stormpathLoginUrl')}") Back to Log In diff --git a/server/user-provider.js b/server/user-provider.js index b048224..19c0b2a 100644 --- a/server/user-provider.js +++ b/server/user-provider.js @@ -44,7 +44,13 @@ module.exports = function(app) { }, }, expandProviderData : true, - expandCustomData : true + expandCustomData : true, + registrationView: __dirname + '/../client/views/register.jade', + loginView: __dirname + '/../client/views/login.jade', + templateContext : { + toc : config.toc ? config.toc : false, + tocupdate : config.tocupdate + } })); return stormpath;