Skip to content
Snippets Groups Projects
Commit 527ffac1 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Secret URL - Fixes #1574

parent 13df770d
No related merge requests found
...@@ -107,13 +107,15 @@ FlowRouter.route '/fxos', ...@@ -107,13 +107,15 @@ FlowRouter.route '/fxos',
FlowRouter.route '/register/:hash', FlowRouter.route '/register/:hash',
name: 'register-secret-url' name: 'register-secret-url'
action: (params) -> action: (params) ->
if RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL' BlazeLayout.render 'secretURL'
Meteor.call 'checkRegistrationSecretURL', params.hash, (err, success) ->
if success # if RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL'
Session.set 'loginDefaultState', 'register' # Meteor.call 'checkRegistrationSecretURL', params.hash, (err, success) ->
BlazeLayout.render 'main', {center: 'home'} # if success
KonchatNotification.getDesktopPermission() # Session.set 'loginDefaultState', 'register'
else # BlazeLayout.render 'main', {center: 'home'}
BlazeLayout.render 'blankLayout', { render: 'invalidSecretURL' } # KonchatNotification.getDesktopPermission()
else # else
BlazeLayout.render 'blankLayout', { render: 'invalidSecretURL' } # BlazeLayout.render 'logoLayout', { render: 'invalidSecretURL' }
# else
# BlazeLayout.render 'logoLayout', { render: 'invalidSecretURL' }
<template name="blankLayout"> <template name="logoLayout">
<section class="full-page"> <section class="full-page">
<div class="wrapper"> <div class="wrapper">
<header> <header>
......
...@@ -25,7 +25,7 @@ Package.onUse(function(api) { ...@@ -25,7 +25,7 @@ Package.onUse(function(api) {
api.addFiles('master/main.html', 'client'); api.addFiles('master/main.html', 'client');
api.addFiles('master/loading.html', 'client'); api.addFiles('master/loading.html', 'client');
api.addFiles('master/error.html', 'client'); api.addFiles('master/error.html', 'client');
api.addFiles('master/blankLayout.html', 'client'); api.addFiles('master/logoLayout.html', 'client');
api.addFiles('master/main.coffee', 'client'); api.addFiles('master/main.coffee', 'client');
}); });
...@@ -82,6 +82,7 @@ Package.onUse(function(api) { ...@@ -82,6 +82,7 @@ Package.onUse(function(api) {
api.addFiles('views/app/privateHistory.html', 'client'); api.addFiles('views/app/privateHistory.html', 'client');
api.addFiles('views/app/room.html', 'client'); api.addFiles('views/app/room.html', 'client');
api.addFiles('views/app/roomSearch.html', 'client'); api.addFiles('views/app/roomSearch.html', 'client');
api.addFiles('views/app/secretURL.html', 'client');
api.addFiles('views/app/userSearch.html', 'client'); api.addFiles('views/app/userSearch.html', 'client');
api.addFiles('views/app/spotlight/mobileMessageMenu.html', 'client'); api.addFiles('views/app/spotlight/mobileMessageMenu.html', 'client');
api.addFiles('views/app/spotlight/spotlight.html', 'client'); api.addFiles('views/app/spotlight/spotlight.html', 'client');
...@@ -97,6 +98,7 @@ Package.onUse(function(api) { ...@@ -97,6 +98,7 @@ Package.onUse(function(api) {
api.addFiles('views/app/privateHistory.coffee', 'client'); api.addFiles('views/app/privateHistory.coffee', 'client');
api.addFiles('views/app/room.coffee', 'client'); api.addFiles('views/app/room.coffee', 'client');
api.addFiles('views/app/roomSearch.coffee', 'client'); api.addFiles('views/app/roomSearch.coffee', 'client');
api.addFiles('views/app/secretURL.coffee', 'client');
api.addFiles('views/app/spotlight/mobileMessageMenu.coffee', 'client'); api.addFiles('views/app/spotlight/mobileMessageMenu.coffee', 'client');
api.addFiles('views/app/spotlight/spotlight.coffee', 'client'); api.addFiles('views/app/spotlight/spotlight.coffee', 'client');
api.addFiles('views/app/videoCall/videoButtons.coffee', 'client'); api.addFiles('views/app/videoCall/videoButtons.coffee', 'client');
......
Template.secretURL.helpers
registrationAllowed: ->
return RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL' and Template.instance().hashIsValid?.get()
ready: ->
return Template.instance().subscriptionsReady?() and Template.instance().hashReady?.get()
Template.secretURL.onCreated ->
@subscribe 'admin-settings'
@hashIsValid = new ReactiveVar false
@hashReady = new ReactiveVar false
Meteor.call 'checkRegistrationSecretURL', FlowRouter.getParam('hash'), (err, success) =>
@hashReady.set true
if success
Session.set 'loginDefaultState', 'register'
KonchatNotification.getDesktopPermission()
@hashIsValid.set true
else
@hashIsValid.set false
<template name="secretURL">
{{#if ready}}
{{#if registrationAllowed}}
{{> main center="home"}}
{{else}}
{{> logoLayout render="invalidSecretURL"}}
{{/if}}
{{else}}
{{> loading}}
{{/if}}
</template>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment