Secret URL - Fixes #1574

pull/1582/head
Marcelo Schmidt 11 years ago
parent 13df770d41
commit 527ffac1fd
  1. 22
      client/routes/router.coffee
  2. 2
      packages/rocketchat-ui-master/master/logoLayout.html
  3. 2
      packages/rocketchat-ui-master/package.js
  4. 2
      packages/rocketchat-ui/package.js
  5. 21
      packages/rocketchat-ui/views/app/secretURL.coffee
  6. 11
      packages/rocketchat-ui/views/app/secretURL.html

@ -107,13 +107,15 @@ FlowRouter.route '/fxos',
FlowRouter.route '/register/:hash',
name: 'register-secret-url'
action: (params) ->
if RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL'
Meteor.call 'checkRegistrationSecretURL', params.hash, (err, success) ->
if success
Session.set 'loginDefaultState', 'register'
BlazeLayout.render 'main', {center: 'home'}
KonchatNotification.getDesktopPermission()
else
BlazeLayout.render 'blankLayout', { render: 'invalidSecretURL' }
else
BlazeLayout.render 'blankLayout', { render: 'invalidSecretURL' }
BlazeLayout.render 'secretURL'
# if RocketChat.settings.get('Accounts_RegistrationForm') is 'Secret URL'
# Meteor.call 'checkRegistrationSecretURL', params.hash, (err, success) ->
# if success
# Session.set 'loginDefaultState', 'register'
# BlazeLayout.render 'main', {center: 'home'}
# KonchatNotification.getDesktopPermission()
# else
# BlazeLayout.render 'logoLayout', { render: 'invalidSecretURL' }
# else
# BlazeLayout.render 'logoLayout', { render: 'invalidSecretURL' }

@ -1,4 +1,4 @@
<template name="blankLayout">
<template name="logoLayout">
<section class="full-page">
<div class="wrapper">
<header>

@ -25,7 +25,7 @@ Package.onUse(function(api) {
api.addFiles('master/main.html', 'client');
api.addFiles('master/loading.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');
});

@ -82,6 +82,7 @@ Package.onUse(function(api) {
api.addFiles('views/app/privateHistory.html', 'client');
api.addFiles('views/app/room.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/spotlight/mobileMessageMenu.html', 'client');
api.addFiles('views/app/spotlight/spotlight.html', 'client');
@ -97,6 +98,7 @@ Package.onUse(function(api) {
api.addFiles('views/app/privateHistory.coffee', 'client');
api.addFiles('views/app/room.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/spotlight.coffee', 'client');
api.addFiles('views/app/videoCall/videoButtons.coffee', 'client');

@ -0,0 +1,21 @@
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

@ -0,0 +1,11 @@
<template name="secretURL">
{{#if ready}}
{{#if registrationAllowed}}
{{> main center="home"}}
{{else}}
{{> logoLayout render="invalidSecretURL"}}
{{/if}}
{{else}}
{{> loading}}
{{/if}}
</template>
Loading…
Cancel
Save