iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 3
2
自我挑戰組

我在繡房繡小主常服的日子-- 初入前端工程師的第一個小挑戰系列 第 3

[03] firebase 使用帳號密碼註冊

大家好我是紫禁城的繡女
本集跟大家介紹 firebase一個好用的功能
Authentication!!
Authentication


首先把鍋燒熱,鍋燒熱後加入寬油


在firebase的左方面板選擇 authentication
點選登入方式 並且將電子郵件/密碼 登入方式打開

Authentication

我們先來做一個很陽春的介面蒐集user 輸入的mail 和 password
HTML

 <div>
   輸入帳號 : <input id="mail" type="email">
 </div>
 <div>
   輸入密碼 : <input id="password" type="password">
 </div>
 <button id = "btnSingUp">註冊</button> 

JS

var btn = document.getElementById('btnSingUp');

btn.onclick = function() {
  var email = document.getElementById('mail').value;
  var password = document.getElementById('password').value;
}

只要將 mail 和 password 使用createUserWithEmailAndPassword
就可以送出創建帳號了
加上這一段

firebase.auth().createUserWithEmailAndPassword(email, password);
var btn = document.getElementById('btnSingUp');

btn.onclick = function() {
  var email = document.getElementById('mail').value;
  var password = document.getElementById('password').value;
  firebase.auth().createUserWithEmailAndPassword(email, password);
}

創帳號

點選註冊後回到 firebase的後台就可以看到註冊成功了!!

註冊成功!!


下面是 firebase authentication 帳號密碼註冊的技術總結
第一、沒有google帳號的同學可以先註冊。
第二、忘記把登入方式打開的同學記得先打開。
firebase authentication 帳號密碼註冊的技術總結完畢

關注紫禁城的繡女 這裏總有一個步驟你忘了怎麼做



上一篇
[02] 開始使用firebase
下一篇
[04] firebase 使用google facebook註冊
系列文
我在繡房繡小主常服的日子-- 初入前端工程師的第一個小挑戰30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 則留言

0
SunAllen
iT邦研究生 1 級 ‧ 2018-11-01 18:45:27

大大請問,什麼是,寬油?

我要留言

立即登入留言