signup dialog changes
- send empty or invalid emails to the standard fxa signup page - show the signup dialog when file too big and not logged in
This commit is contained in:
parent
c585c34c01
commit
a79400f99f
2 changed files with 24 additions and 14 deletions
|
@ -4,6 +4,9 @@ const { bytes } = require('../utils');
|
|||
|
||||
module.exports = function() {
|
||||
return function(state, emit, close) {
|
||||
setTimeout(function() {
|
||||
document.getElementById('email-input').focus();
|
||||
});
|
||||
return html`
|
||||
<div class="flex flex-col p-4">
|
||||
<p class="p-8">
|
||||
|
@ -39,18 +42,20 @@ module.exports = function() {
|
|||
</button>
|
||||
</div>`;
|
||||
|
||||
function emailish(str) {
|
||||
if (!str) {
|
||||
return false;
|
||||
}
|
||||
// just check if it's the right shape
|
||||
const a = str.split('@');
|
||||
return a.length === 2 && a.every(s => s.length > 0);
|
||||
}
|
||||
|
||||
function submitEmail(event) {
|
||||
event.preventDefault();
|
||||
const el = document.getElementById('email-input');
|
||||
const email = el.value;
|
||||
if (email) {
|
||||
// just check if it's the right shape
|
||||
const a = email.split('@');
|
||||
if (a.length === 2 && a.every(s => s.length > 0)) {
|
||||
return emit('login', email);
|
||||
}
|
||||
}
|
||||
el.value = '';
|
||||
emit('login', emailish(email) ? email : null);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue