mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 23:58:06 -05:00
Compare commits
634 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5a48b49dc | ||
|
|
bab47e1c1f | ||
|
|
cee7457d7f | ||
|
|
95ed7d3dd8 | ||
|
|
edffc79bf0 | ||
|
|
1d6658097e | ||
|
|
dcbfb32e66 | ||
|
|
c146b25f31 | ||
|
|
9a08620378 | ||
|
|
407f223c65 | ||
|
|
f2a42abbf4 | ||
|
|
218d14a227 | ||
|
|
501ae58a25 | ||
|
|
373d83cc9d | ||
|
|
fb7faf7466 | ||
|
|
9784555304 | ||
|
|
13cb6e269d | ||
|
|
a7d64ae313 | ||
|
|
34cb23ed9c | ||
|
|
14aa380d80 | ||
|
|
c4c8fad66c | ||
|
|
4b72064bfc | ||
|
|
8b0b849a67 | ||
|
|
4f849f4fa9 | ||
|
|
3926e6d9eb | ||
|
|
506eaf495d | ||
|
|
8dbe5b2fe8 | ||
|
|
207ddc5127 | ||
|
|
367ea42762 | ||
|
|
89a08357d6 | ||
|
|
eed51179c7 | ||
|
|
232c855c54 | ||
|
|
afec6655c7 | ||
|
|
7d1dc56fdb | ||
|
|
890bd9e3b5 | ||
|
|
1e63c640c0 | ||
|
|
8acbdd6d93 | ||
|
|
400eaf7fbe | ||
|
|
df8b79a53f | ||
|
|
ef6c73b221 | ||
|
|
c7a719a979 | ||
|
|
60c5774ff4 | ||
|
|
90f46bac37 | ||
|
|
ee8f0f8e83 | ||
|
|
41e2db2120 | ||
|
|
7f419bf99a | ||
|
|
44f0fd741f | ||
|
|
2d655ea46e | ||
|
|
49ed129c40 | ||
|
|
8e2e3f6fda | ||
|
|
31c4f31ef4 | ||
|
|
8606e1e671 | ||
|
|
2df5efcece | ||
|
|
43c349a2fc | ||
|
|
0d392fa49f | ||
|
|
d0f0853c75 | ||
|
|
88625d488f | ||
|
|
f08e0ad24a | ||
|
|
3632ddf674 | ||
|
|
cddba28945 | ||
|
|
032c4476ae | ||
|
|
319d9fa648 | ||
|
|
59bedaa1e7 | ||
|
|
fc1ac76ddf | ||
|
|
6d32d2447c | ||
|
|
d4bf52bdfd | ||
|
|
f8d1ea90bc | ||
|
|
2fa9303ab3 | ||
|
|
b5172a0cdb | ||
|
|
e1c53d6580 | ||
|
|
875217d8c1 | ||
|
|
55eabee800 | ||
|
|
8d4c3647a7 | ||
|
|
700284fc67 | ||
|
|
1542b7da29 | ||
|
|
451ff6d49c | ||
|
|
542df3634b | ||
|
|
3c5acaf531 | ||
|
|
025b1c8734 | ||
|
|
43800b4b85 | ||
|
|
baf5e00544 | ||
|
|
289dd5f221 | ||
|
|
9f5b83750e | ||
|
|
8593801130 | ||
|
|
bb879f7154 | ||
|
|
772b74a657 | ||
|
|
51bf327017 | ||
|
|
14eb1362e3 | ||
|
|
f3e8fd3baa | ||
|
|
a0ccc1cf96 | ||
|
|
b39faffde4 | ||
|
|
366a428b2c | ||
|
|
7d103bc627 | ||
|
|
bdd2e7e24f | ||
|
|
c82e4cf47b | ||
|
|
63ccdfb34a | ||
|
|
2ee0068d77 | ||
|
|
57d1a1d381 | ||
|
|
5d5636f03a | ||
|
|
a3ae35e9c9 | ||
|
|
e8e0c27599 | ||
|
|
429afcbe8a | ||
|
|
ef9a2f4104 | ||
|
|
0cd72a56f9 | ||
|
|
1ba53dc369 | ||
|
|
faef12cf2b | ||
|
|
c82a381f29 | ||
|
|
a793472a3e | ||
|
|
ad91686b62 | ||
|
|
1bb5fcbbec | ||
|
|
80423c8f01 | ||
|
|
743b6937e2 | ||
|
|
e16d60d0fe | ||
|
|
9d16f33c7b | ||
|
|
c9a0f896cc | ||
|
|
aa8d89579a | ||
|
|
210c62af38 | ||
|
|
3048fe0960 | ||
|
|
628f2fb2be | ||
|
|
13ba27497b | ||
|
|
7386f419e3 | ||
|
|
e07932c181 | ||
|
|
d0eafe70dc | ||
|
|
7e6da424e2 | ||
|
|
81bf3ad8c1 | ||
|
|
51c05a5b21 | ||
|
|
1d138dd40c | ||
|
|
c43ae8cb47 | ||
|
|
cd60c747cc | ||
|
|
837baaf2e1 | ||
|
|
e0395367e4 | ||
|
|
fb17e2755f | ||
|
|
f4462cd85e | ||
|
|
8bb358cf80 | ||
|
|
98fc5e8e39 | ||
|
|
dfbed22cee | ||
|
|
fd03f9e353 | ||
|
|
a19e78cdb4 | ||
|
|
b88af5d65e | ||
|
|
45b831c4ea | ||
|
|
f12be553cc | ||
|
|
4896a9b41a | ||
|
|
eed641d2be | ||
|
|
97aa37bb50 | ||
|
|
15135f7dc6 | ||
|
|
e39b9b9134 | ||
|
|
4a5e7a9143 | ||
|
|
8664bac682 | ||
|
|
3e588d2d25 | ||
|
|
23fbc35b2d | ||
|
|
2c844b0649 | ||
|
|
0c2cab7c94 | ||
|
|
2da46d8dd6 | ||
|
|
507573994a | ||
|
|
f26e05c200 | ||
|
|
f5cc775a5f | ||
|
|
b94b957490 | ||
|
|
057afdc1e6 | ||
|
|
c249ba991b | ||
|
|
ffa8a80f42 | ||
|
|
4f60544396 | ||
|
|
79d7eddfc3 | ||
|
|
b25492ea01 | ||
|
|
0e33f55b7d | ||
|
|
6991ff4eb4 | ||
|
|
16f27b3074 | ||
|
|
87108ad4d5 | ||
|
|
6d37e32437 | ||
|
|
a3c0c65269 | ||
|
|
2c1b5fb240 | ||
|
|
50f820a6cf | ||
|
|
34d9053819 | ||
|
|
94be5fb6a1 | ||
|
|
14a3084b59 | ||
|
|
bbbff3a350 | ||
|
|
a451b98cf2 | ||
|
|
c3759be33e | ||
|
|
d85d45bcef | ||
|
|
cb8c72171f | ||
|
|
e0b9915418 | ||
|
|
26c7dffe2a | ||
|
|
22e2ab4be3 | ||
|
|
a3d9161712 | ||
|
|
2e3b70ca62 | ||
|
|
1a83b58d72 | ||
|
|
e3f4beced4 | ||
|
|
9437f2de57 | ||
|
|
70f3ae24e0 | ||
|
|
64ea43f6ab | ||
|
|
a59fd76da4 | ||
|
|
1f30f6fa85 | ||
|
|
6486351350 | ||
|
|
d65bb156c1 | ||
|
|
6851f1d1c4 | ||
|
|
769506e96c | ||
|
|
eefae83c92 | ||
|
|
ec0b55a13a | ||
|
|
63fe1a843f | ||
|
|
748803cd59 | ||
|
|
97a6fd2895 | ||
|
|
12a265d1eb | ||
|
|
29943a26e6 | ||
|
|
249064d8f6 | ||
|
|
f8daa52b9b | ||
|
|
a17abad57a | ||
|
|
3ef4e0b701 | ||
|
|
83a32e6d21 | ||
|
|
a3fcb3b682 | ||
|
|
0d95c5ae8b | ||
|
|
9fb079c097 | ||
|
|
43068ac239 | ||
|
|
fb18c6ca8d | ||
|
|
14863ba4c9 | ||
|
|
885c61ece3 | ||
|
|
940b939791 | ||
|
|
406915cb78 | ||
|
|
c5de662454 | ||
|
|
0a6cd99d03 | ||
|
|
ffeb942699 | ||
|
|
f148c90fc7 | ||
|
|
d022fb8cc4 | ||
|
|
421ffc479f | ||
|
|
0f134f7030 | ||
|
|
5d73e1e3bb | ||
|
|
f48b6f1651 | ||
|
|
34ed989725 | ||
|
|
b52e642c01 | ||
|
|
098345aace | ||
|
|
caa1a55d17 | ||
|
|
fee43f3c11 | ||
|
|
fad60747d5 | ||
|
|
5ceef2d4de | ||
|
|
6635caf12e | ||
|
|
e051360ea2 | ||
|
|
6bb74c5abf | ||
|
|
a79057070c | ||
|
|
12fc5b76d8 | ||
|
|
ad5892391d | ||
|
|
df43a3560a | ||
|
|
9aa17eec07 | ||
|
|
45cc668683 | ||
|
|
19045a483d | ||
|
|
f618b88f91 | ||
|
|
81cb5b00f4 | ||
|
|
54fb582269 | ||
|
|
44f7325a91 | ||
|
|
4ab54943ad | ||
|
|
45245df16a | ||
|
|
63ea6533de | ||
|
|
aedc9b7696 | ||
|
|
28248e3167 | ||
|
|
612e30258c | ||
|
|
76c888268b | ||
|
|
07f2712a22 | ||
|
|
75e8555035 | ||
|
|
a823e510f3 | ||
|
|
2d53cf4424 | ||
|
|
e91b8ee0ba | ||
|
|
eced9b015b | ||
|
|
dbc3c4f08f | ||
|
|
0d56ae2705 | ||
|
|
c1e4031e3b | ||
|
|
964ae53e5b | ||
|
|
2e5b5fcd70 | ||
|
|
241e8077e3 | ||
|
|
55e726e4a7 | ||
|
|
f9d13f015a | ||
|
|
e704221842 | ||
|
|
2a6d608bd8 | ||
|
|
b2dc388556 | ||
|
|
214ce91bf7 | ||
|
|
a460d79b08 | ||
|
|
2f3a59640b | ||
|
|
1102600720 | ||
|
|
4e4e42e1ae | ||
|
|
20e299bce0 | ||
|
|
5be5220e5a | ||
|
|
fcb04f5302 | ||
|
|
45016829d6 | ||
|
|
337db5a3a2 | ||
|
|
a921c10e6a | ||
|
|
101e50f9df | ||
|
|
6064ca8b73 | ||
|
|
2dd322579f | ||
|
|
e72839f4bc | ||
|
|
45438fcfc4 | ||
|
|
f3329110ba | ||
|
|
369ba267ef | ||
|
|
a42033cb04 | ||
|
|
1aab449933 | ||
|
|
ee65cd60c9 | ||
|
|
c000b58c56 | ||
|
|
40e8812d75 | ||
|
|
cc6046b8cc | ||
|
|
6b1ead8654 | ||
|
|
518f6f39bf | ||
|
|
6edbeb82cd | ||
|
|
a8d0a8f63d | ||
|
|
62703943be | ||
|
|
e3a00b27d1 | ||
|
|
8266e85576 | ||
|
|
4372dd402b | ||
|
|
6e4b0b94bc | ||
|
|
bf74a506c8 | ||
|
|
e01fb8bb22 | ||
|
|
14785afe8d | ||
|
|
66a96ab9d6 | ||
|
|
76b87dc0e8 | ||
|
|
cb663e96a3 | ||
|
|
1192c76f62 | ||
|
|
ecd2187652 | ||
|
|
d1571627b7 | ||
|
|
52b24e41de | ||
|
|
5f62f28d6e | ||
|
|
c84169122f | ||
|
|
bafc23eae5 | ||
|
|
aa6cb411bc | ||
|
|
354df3bc65 | ||
|
|
6f140faf0d | ||
|
|
05bf574799 | ||
|
|
40f02ae69b | ||
|
|
3aedbf0a4d | ||
|
|
fa067b31c6 | ||
|
|
517010e2c5 | ||
|
|
4adc792422 | ||
|
|
0640b318ca | ||
|
|
95fad8b408 | ||
|
|
94adec3cee | ||
|
|
87b73540a4 | ||
|
|
25f908ad9c | ||
|
|
4656e96d9e | ||
|
|
389cd85d47 | ||
|
|
3b0bc08ec6 | ||
|
|
2eca92f950 | ||
|
|
acc45c5a44 | ||
|
|
e4dd1509c4 | ||
|
|
b8f644198d | ||
|
|
715192a770 | ||
|
|
31aceeb104 | ||
|
|
af8f7e9797 | ||
|
|
6c916488af | ||
|
|
246a50876a | ||
|
|
8866b8e5eb | ||
|
|
1c8e97c75a | ||
|
|
cd9ad848fb | ||
|
|
be15116426 | ||
|
|
9d90a559ce | ||
|
|
d98f38cf5f | ||
|
|
f99636da76 | ||
|
|
6260c29a86 | ||
|
|
45481df14a | ||
|
|
7eccd4e9c6 | ||
|
|
2cf18f99e0 | ||
|
|
bcbea08187 | ||
|
|
b20de505ab | ||
|
|
20bde34981 | ||
|
|
e9abba797a | ||
|
|
dac90eeb80 | ||
|
|
f220b992c3 | ||
|
|
2bb8e1c236 | ||
|
|
e44a8b2d43 | ||
|
|
268bd69164 | ||
|
|
d750709250 | ||
|
|
c9a2d0654e | ||
|
|
26723d9bbc | ||
|
|
75f9e76f65 | ||
|
|
962cea2039 | ||
|
|
64aad8b138 | ||
|
|
0d279415f3 | ||
|
|
fc45f916d6 | ||
|
|
3722aa6296 | ||
|
|
5664b19703 | ||
|
|
d870c0dced | ||
|
|
8ab7963e50 | ||
|
|
d545fe3e3f | ||
|
|
3e23371b01 | ||
|
|
6bda962547 | ||
|
|
f141bb57ec | ||
|
|
9001123b7e | ||
|
|
5919620b24 | ||
|
|
a45bbe1783 | ||
|
|
2514c69d81 | ||
|
|
8b53975652 | ||
|
|
bdd6081815 | ||
|
|
e55c9caa05 | ||
|
|
0f8695dd4b | ||
|
|
d9deeba582 | ||
|
|
d1948b79d3 | ||
|
|
371d657e35 | ||
|
|
82087ce211 | ||
|
|
463351922f | ||
|
|
3080e9e018 | ||
|
|
caf633854d | ||
|
|
f016e823cd | ||
|
|
9843cb27dc | ||
|
|
50bbb56576 | ||
|
|
135d898e0e | ||
|
|
b01ae718b3 | ||
|
|
8c9cc8d355 | ||
|
|
95689757c0 | ||
|
|
0720bc72c3 | ||
|
|
5f1c210511 | ||
|
|
16b3d6d67c | ||
|
|
7b3081760f | ||
|
|
5a3b7a1771 | ||
|
|
db011c0192 | ||
|
|
f39c6fd927 | ||
|
|
8b9fba73fd | ||
|
|
12298ef968 | ||
|
|
1b02534bef | ||
|
|
42b68d53a7 | ||
|
|
4f2e915833 | ||
|
|
f8c1ee0f90 | ||
|
|
2458334de6 | ||
|
|
451ba5362b | ||
|
|
31801fc9a0 | ||
|
|
ce0414271a | ||
|
|
701d4929d8 | ||
|
|
e61f4bae40 | ||
|
|
88e9a85d6a | ||
|
|
d6ffa8ef22 | ||
|
|
448106f458 | ||
|
|
a88f88eb4b | ||
|
|
2b10d517f6 | ||
|
|
4db1d819b0 | ||
|
|
840c2e7306 | ||
|
|
657507b705 | ||
|
|
975bb8490d | ||
|
|
6ceb649b10 | ||
|
|
bcb67ecde8 | ||
|
|
4184e23d71 | ||
|
|
a24f98f315 | ||
|
|
c74e2693a3 | ||
|
|
7a7a099573 | ||
|
|
215d034b86 | ||
|
|
3323197d68 | ||
|
|
1009096172 | ||
|
|
197ac56520 | ||
|
|
92b94bc84d | ||
|
|
71fc5b351a | ||
|
|
4e9860d268 | ||
|
|
ad8547dede | ||
|
|
079ed3b6f8 | ||
|
|
5e014ab607 | ||
|
|
0f6014b84d | ||
|
|
b5629ebf1d | ||
|
|
ee01bac8b0 | ||
|
|
3e1c9e343c | ||
|
|
399774af69 | ||
|
|
a62faa2c82 | ||
|
|
059dfc8cce | ||
|
|
cc6a582408 | ||
|
|
ce08d7abb8 | ||
|
|
83213569dd | ||
|
|
be2e17841e | ||
|
|
0591d92f53 | ||
|
|
244cc60d35 | ||
|
|
94c6d5f5cc | ||
|
|
0fe308e7a7 | ||
|
|
801cf00146 | ||
|
|
83002017ea | ||
|
|
0263b8dbfc | ||
|
|
4beeca46c4 | ||
|
|
7c4e8c8d17 | ||
|
|
36613b09d7 | ||
|
|
31774452e8 | ||
|
|
6eb412efae | ||
|
|
244c22a6a2 | ||
|
|
7d3d6fb3f0 | ||
|
|
ce071502ee | ||
|
|
32f63b2fb9 | ||
|
|
bacd9d244c | ||
|
|
a665aada25 | ||
|
|
0c5d78e31c | ||
|
|
60dc4be8c1 | ||
|
|
f7b6d78606 | ||
|
|
c605758800 | ||
|
|
2135ae5e5e | ||
|
|
a3d31778c2 | ||
|
|
d7f6855ad8 | ||
|
|
0a9e2c961f | ||
|
|
8387cc9474 | ||
|
|
70eb18d766 | ||
|
|
bf4641c8cf | ||
|
|
c76f0e59b7 | ||
|
|
fa2d333bde | ||
|
|
15a50dc8d7 | ||
|
|
a47928090a | ||
|
|
6fc6a28e3b | ||
|
|
6bc2db4567 | ||
|
|
5abdb65e56 | ||
|
|
25a3eeb30a | ||
|
|
33d5335f53 | ||
|
|
47077bf810 | ||
|
|
9caae50339 | ||
|
|
8a4d610c58 | ||
|
|
3d2a908f64 | ||
|
|
d2ea28b3db | ||
|
|
7a44233fb9 | ||
|
|
a9bb7d0318 | ||
|
|
ebe65b516b | ||
|
|
ebf79be163 | ||
|
|
88724e10ad | ||
|
|
30405943b5 | ||
|
|
9c0dccfec1 | ||
|
|
9fe7040db9 | ||
|
|
4c3838bb75 | ||
|
|
48aa20897f | ||
|
|
2a5f8b6688 | ||
|
|
8ee01fc10b | ||
|
|
d7985e7ddb | ||
|
|
ae8b0914a9 | ||
|
|
6720f93d2c | ||
|
|
13d4fd4088 | ||
|
|
bbd614a725 | ||
|
|
eb0540e028 | ||
|
|
08374f1d33 | ||
|
|
a5f8cd9d32 | ||
|
|
54e7a3b9d9 | ||
|
|
e761a8df2b | ||
|
|
65d8e94ed9 | ||
|
|
83b88353b5 | ||
|
|
39227bd494 | ||
|
|
e841c4c5ef | ||
|
|
e90ba2fbcb | ||
|
|
e6b5f5f31a | ||
|
|
245b1f9de0 | ||
|
|
e05523f767 | ||
|
|
2c8727ad42 | ||
|
|
b1508e93e1 | ||
|
|
5b57aa0b85 | ||
|
|
768656deb9 | ||
|
|
fe10a5b17a | ||
|
|
22784cb55a | ||
|
|
656720583f | ||
|
|
a20cca6873 | ||
|
|
8d78dc072f | ||
|
|
b2a2e85412 | ||
|
|
c2c74b0a39 | ||
|
|
92bb772d36 | ||
|
|
783234c72a | ||
|
|
2671f19cb1 | ||
|
|
72ea8392a8 | ||
|
|
bb44d422d6 | ||
|
|
5d304ae63a | ||
|
|
0c991af985 | ||
|
|
ac702843dd | ||
|
|
4015488b90 | ||
|
|
cccc137714 | ||
|
|
3fa0afad67 | ||
|
|
29142418ba | ||
|
|
c3b54dc0c2 | ||
|
|
a0232cf763 | ||
|
|
57980ba82a | ||
|
|
bcdd54cc5e | ||
|
|
83d5d3142d | ||
|
|
cbbe932ee2 | ||
|
|
593ae41f9d | ||
|
|
e9770fd434 | ||
|
|
53f6785e11 | ||
|
|
1b48fd0abe | ||
|
|
b835059baf | ||
|
|
f7359d6d96 | ||
|
|
4924dd68ae | ||
|
|
02ed166f51 | ||
|
|
9a11586a72 | ||
|
|
b5a5bae09c | ||
|
|
e757543323 | ||
|
|
7b000390a0 | ||
|
|
3f3ec236bb | ||
|
|
22dd3b489d | ||
|
|
0d45142845 | ||
|
|
62d6b5afb7 | ||
|
|
934fe45cfe | ||
|
|
675ae4d802 | ||
|
|
48251f236f | ||
|
|
8e6e70eaa7 | ||
|
|
4925ffda31 | ||
|
|
f89921e153 | ||
|
|
863b811167 | ||
|
|
d1f8884ee6 | ||
|
|
9caf07dd4f | ||
|
|
2044fffa25 | ||
|
|
2e442d81f7 | ||
|
|
28f0e3281a | ||
|
|
6a0d881554 | ||
|
|
4a9eee5a1c | ||
|
|
a4d3b9f14a | ||
|
|
1beac93961 | ||
|
|
8286325fd0 | ||
|
|
228f24c491 | ||
|
|
cff78eec23 | ||
|
|
20d786d7ca | ||
|
|
0c1b1a896f | ||
|
|
db8e247aa5 | ||
|
|
e01fdba557 | ||
|
|
0a1e55f11c | ||
|
|
85bcbdf18b | ||
|
|
a45c4c0ac4 | ||
|
|
d293e00ef5 | ||
|
|
201a4f92c2 | ||
|
|
71f90c0d6e | ||
|
|
26e22d8e95 | ||
|
|
9805728964 | ||
|
|
f64022a57b | ||
|
|
e79201aef8 | ||
|
|
a2498074f1 | ||
|
|
536279b05b | ||
|
|
031351224a | ||
|
|
74ab3e9a05 | ||
|
|
1bc9ebd7de | ||
|
|
81869de9c5 | ||
|
|
f6301c08f6 | ||
|
|
d66d9297fb | ||
|
|
78bbf6dcc4 | ||
|
|
1ff64fbbd3 | ||
|
|
3226ab16c1 | ||
|
|
13285d7ef3 | ||
|
|
7346ce709a | ||
|
|
8ac32f14b1 | ||
|
|
91ef42dc0a | ||
|
|
1ddca80cee | ||
|
|
896521be73 | ||
|
|
6e419ce821 | ||
|
|
93df02f601 | ||
|
|
fdd9337b64 | ||
|
|
2040b021e1 | ||
|
|
d122faf410 | ||
|
|
eaa4713e22 | ||
|
|
0c1a14e8f2 | ||
|
|
357ce9c3b5 | ||
|
|
830d3e86ee | ||
|
|
209b97d86b | ||
|
|
eba2527b8e |
203
.github/workflows/test.yml
vendored
Normal file
203
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
name: Test
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
gemfile:
|
||||
- Gemfile
|
||||
- gemfiles/Gemfile-rails-main
|
||||
- gemfiles/Gemfile-rails-7-0
|
||||
- gemfiles/Gemfile-rails-6-1
|
||||
- gemfiles/Gemfile-rails-6-0
|
||||
- gemfiles/Gemfile-rails-5-2
|
||||
- gemfiles/Gemfile-rails-5-1
|
||||
- gemfiles/Gemfile-rails-5-0
|
||||
- gemfiles/Gemfile-rails-4-2
|
||||
- gemfiles/Gemfile-rails-4-1
|
||||
ruby:
|
||||
- '3.3'
|
||||
- '3.2'
|
||||
- '3.1'
|
||||
- '3.0'
|
||||
- '2.7'
|
||||
- '2.6'
|
||||
- '2.5'
|
||||
- '2.4'
|
||||
- '2.3'
|
||||
- '2.2'
|
||||
- '2.1'
|
||||
env:
|
||||
- DEVISE_ORM=active_record
|
||||
- DEVISE_ORM=mongoid
|
||||
exclude:
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.7' # Rails > 7.1 supports Ruby >= 3.1
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '3.0' # Rails > 7.1 supports Ruby >= 3.1
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.6'
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.5'
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.4'
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.3'
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.2'
|
||||
- gemfile: Gemfile
|
||||
ruby: '2.1'
|
||||
- gemfile: Gemfile
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.6'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.5'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.4'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-main
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
ruby: '2.6'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
ruby: '2.5'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
ruby: '2.4'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
ruby: '2.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
ruby: '2.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-7-0
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-6-1
|
||||
ruby: '2.4'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-1
|
||||
ruby: '2.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-1
|
||||
ruby: '2.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-1
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-1
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '3.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '2.4'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '2.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '2.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-6-0
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '3.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '2.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-2
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
ruby: '3.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-1
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
ruby: '3.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
ruby: '2.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-5-0
|
||||
env: DEVISE_ORM=mongoid
|
||||
- gemfile: gemfiles/Gemfile-rails-4-2
|
||||
ruby: '3.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-2
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-2
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-2
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-2
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-2
|
||||
ruby: '2.6'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '3.3'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '3.2'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '3.1'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '3.0'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '2.7'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '2.6'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '2.5'
|
||||
- gemfile: gemfiles/Gemfile-rails-4-1
|
||||
ruby: '2.4'
|
||||
# TODO: lock `ubunty-20.04` due to older Ruby version compatibility, change to `ubuntu-latest` again when dropping older Ruby support.
|
||||
# https://github.com/ruby/setup-ruby/issues/496#issuecomment-1520662740
|
||||
runs-on: ubuntu-20.04
|
||||
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
||||
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Bundler 1.x for Rails 4.x and Ruby <= 2.2
|
||||
if: ${{ matrix.gemfile == 'gemfiles/Gemfile-rails-4-1' || matrix.gemfile == 'gemfiles/Gemfile-rails-4-2' || matrix.ruby <= '2.2' }}
|
||||
run: echo "BUNDLER_VERSION=1.17.3" >> $GITHUB_ENV
|
||||
- name: Setup Rubygems version as default for Ruby < 2.5
|
||||
if: ${{ matrix.ruby < '2.5' }}
|
||||
run: echo "RUBYGEMS_VERSION=default" >> $GITHUB_ENV
|
||||
- name: Setup Rubygems version as 3.2.3 for Ruby 2.5
|
||||
if: ${{ matrix.ruby == '2.5' }}
|
||||
run: echo "RUBYGEMS_VERSION=3.2.3" >> $GITHUB_ENV
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
bundler-cache: true # runs bundle install and caches installed gems automatically
|
||||
bundler: ${{ env.BUNDLER_VERSION || 'default' }}
|
||||
rubygems: ${{ env.RUBYGEMS_VERSION || 'latest' }}
|
||||
- uses: supercharge/mongodb-github-action@1.3.0
|
||||
if: ${{ matrix.env == 'DEVISE_ORM=mongoid' }}
|
||||
- run: bundle exec rake
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ rdoc/*
|
||||
pkg
|
||||
log
|
||||
test/tmp/*
|
||||
gemfiles/*.lock
|
||||
|
||||
44
.travis.yml
44
.travis.yml
@@ -1,44 +0,0 @@
|
||||
language: ruby
|
||||
|
||||
rvm:
|
||||
- 2.3.0
|
||||
- 2.2.4
|
||||
- 2.1.8
|
||||
|
||||
gemfile:
|
||||
- Gemfile
|
||||
- gemfiles/Gemfile.rails-5.0-beta
|
||||
- gemfiles/Gemfile.rails-4.2-stable
|
||||
- gemfiles/Gemfile.rails-4.1-stable
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- rvm: 2.1.8
|
||||
gemfile: gemfiles/Gemfile.rails-5.0-beta
|
||||
- env: DEVISE_ORM=mongoid
|
||||
gemfile: gemfiles/Gemfile.rails-5.0-beta
|
||||
services:
|
||||
- mongodb
|
||||
|
||||
sudo: false
|
||||
|
||||
cache: bundler
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DEVISE_ORM=active_record
|
||||
- DEVISE_ORM=mongoid
|
||||
|
||||
before_install: "rm ${BUNDLE_GEMFILE}.lock"
|
||||
|
||||
before_script: "bundle update"
|
||||
|
||||
script: "bin/test"
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
slack:
|
||||
on_pull_requests: false
|
||||
on_success: change
|
||||
on_failure: always
|
||||
secure: Q3M+kmude3FjisibEeeGe0wSMXgvwLH+vL7Zrx9//q4QtkfnrQ/BBMvY9KXxPEsNF+eys4YopYjTkJ8uRmeboUATW/oQ4Jrv3+u3zkIHK2sFn/Q2cQWpK5w+CbgEnHPjKYnUu34b09njXTgDlr/mqtbPqrKeZ1dLlpKXCB/q4GY=
|
||||
334
CHANGELOG.md
334
CHANGELOG.md
@@ -1,4 +1,328 @@
|
||||
### Unreleased
|
||||
### 4.9.4 - 2024-04-10
|
||||
|
||||
* enhancements
|
||||
* Add support for Ruby 3.3. (no changes needed)
|
||||
|
||||
* bug fixes
|
||||
* Respect locale set by controller in failure app. Devise will carry over the current I18n.locale option when triggering authentication, and will wrap the failure app call with it. [#5567](https://github.com/heartcombo/devise/pull/5567)
|
||||
|
||||
### 4.9.3 - 2023-10-11
|
||||
|
||||
* enhancements
|
||||
* Add support for Rails 7.1.
|
||||
* Add `Devise.deprecator` to integrate with new application deprecators in Rails 7.1. (@soartec-lab, @etiennebarrie)
|
||||
|
||||
### 4.9.2 - 2023-04-03
|
||||
|
||||
* deprecations
|
||||
* Bring back `Devise.activerecord51?` and deprecate it, in order to avoid breakage with some libraries that apparently relied on it.
|
||||
|
||||
### 4.9.1 - 2023-03-31
|
||||
|
||||
* enhancements
|
||||
* Allow resource class scopes to override the global configuration for `sign_in_after_reset_password` behaviour. [#5429](https://github.com/heartcombo/devise/pull/5429) [@mattr](https://github.com/mattr)
|
||||
* Refactor conditional dirty tracking logic to a centralized module to simplify usage throughout the codebase. [#5575](https://github.com/heartcombo/devise/pull/5575)
|
||||
* Improve support for Devise in apps with Active Record and Mongoid ORMs loaded, so it does not incorrectly uses new Active Record dirty tracking APIs with a Mongoid Devise model. [#5576](https://github.com/heartcombo/devise/pull/5576)
|
||||
|
||||
* bug fixes
|
||||
* Failure app will respond with configured `redirect_status` instead of `error_status` if the recall app returns a redirect status (300..399) [#5573](https://github.com/heartcombo/devise/pull/5573)
|
||||
* Fix frozen string exception in validatable. [#5563](https://github.com/heartcombo/devise/pull/5563) [#5465](https://github.com/heartcombo/devise/pull/5465) [@mameier](https://github.com/mameier)
|
||||
|
||||
### 4.9.0 - 2023-02-17
|
||||
|
||||
* enhancements
|
||||
* Add support for Ruby 3.1/3.2.
|
||||
* Add support for Hotwire + Turbo, default in Rails 7+.
|
||||
* Devise uses the latest `responders` version (v3.1.0 or higher), which allows configuring the status used for validation error responses (`error_status`) and for redirects after POST/PUT/PATCH/DELETE requests (`redirect_status`). For backwards compatibility, Devise keeps `error_status` as `:ok` which returns a `200 OK` response, and `redirect_status` to `:found` which returns a `302 Found` response, but you can configure it to return `422 Unprocessable Entity` and `303 See Other` respectively, to match the behavior expected by Hotwire/Turbo:
|
||||
|
||||
```ruby
|
||||
# config/initializers/devise.rb
|
||||
Devise.setup do |config|
|
||||
# ...
|
||||
config.responder.error_status = :unprocessable_entity
|
||||
config.responder.redirect_status = :see_other
|
||||
# ...
|
||||
end
|
||||
```
|
||||
|
||||
These configs are already generated by default with new apps, and existing apps may opt-in as described above. Trying to set these with an older version of `responders` will issue a warning and have no effect, so please upgrade the `responders` version if you're upgrading Devise for this integration. Note that these defaults may change in future versions of Devise, to better match the Rails + Hotwire/Turbo defaults across the board.
|
||||
* If you have a custom responder set on your application and expect it to affect Devise as well, you may need to override the Devise responder entirely with `config.responder = MyApplicationResponder`, so that it uses your custom one. The main reason Devise uses a custom responder is to be able to configure the statuses as described above, but you can also change that config on your own responder if you want. Check the `responders` readme for more info on that.
|
||||
* If you have created a custom responder and/or failure app just to customize responses for better Hotwire/Turbo integration, they should no longer be necessary.
|
||||
* `:turbo_stream` is now treated as a navigational format, so it works like HTML navigation when using Turbo. Note: if you relied on `:turbo_stream` to be treated as a non-navigational format before, you can reconfigure your `navigational_formats` in the Devise initializer file to exclude it.
|
||||
* OmniAuth "Sign in with" links were changed to buttons that generate HTML forms with method=POST, instead of using link + method=POST that required rails-ujs to work. Since rails-ujs is no longer the default for new Rails apps, this allows the OmniAuth buttons to work in any scenario, with or without rails-ujs and/or Turbo. This only affects apps that are using the default `devise/shared/_links.html.erb` partial from Devise with OmniAuth enabled.
|
||||
* The "Cancel my account" button was changed to include the `data-turbo-confirm` option, so that it works with both rails-ujs and Turbo by default.
|
||||
* Devise does not provide "sign out" links/buttons in its shared views, but if you're using `sign_out_via` with `:delete` (the default), and are using links with `method: :delete`, those need to be updated with `data: { turbo_method: :delete }` instead for Turbo.
|
||||
* Check [this upgrade guide](https://github.com/heartcombo/devise/wiki/How-To:-Upgrade-to-Devise-4.9.0-[Hotwire-Turbo-integration]) for more detailed information.
|
||||
|
||||
### 4.8.1 - 2021-12-16
|
||||
|
||||
* enhancements
|
||||
* Add support for Rails 7.0. Please note that Turbo integration is not fully supported by Devise yet.
|
||||
|
||||
### 4.8.0 - 2021-04-29
|
||||
|
||||
* enhancements
|
||||
* Devise now enables the upgrade of OmniAuth 2+. Previously Devise would raise an error if you'd try to upgrade. Please note that OmniAuth 2 is considered a security upgrade and recommended to everyone. You can read more about the details (and possible necessary changes to your app as part of the upgrade) in [their release notes](https://github.com/omniauth/omniauth/releases/tag/v2.0.0). [Devise's OmniAuth Overview wiki](https://github.com/heartcombo/devise/wiki/OmniAuth:-Overview) was also updated to cover OmniAuth 2.0 requirements.
|
||||
- Note that the upgrade required Devise shared links that initiate the OmniAuth flow to be changed to `method: :post`, which is now a requirement for OmniAuth, part of the security improvement. If you have copied and customized the Devise shared links partial to your app, or if you have other links in your app that initiate the OmniAuth flow, they will have to be updated to use `method: :post`, or changed to use buttons (e.g. `button_to`) to work with OmniAuth 2. (if you're using links with `method: :post`, make sure your app has `rails-ujs` or `jquery-ujs` included in order for these links to work properly.)
|
||||
- As part of the OmniAuth 2.0 upgrade you might also need to add the [`omniauth-rails_csrf_protection`](https://github.com/cookpad/omniauth-rails_csrf_protection) gem to your app if you don't have it already. (and you don't want to roll your own code to verify requests.) Check the OmniAuth v2 release notes for more info.
|
||||
* Introduce `Lockable#reset_failed_attempts!` model method to reset failed attempts counter to 0 after the user signs in.
|
||||
- This logic existed inside the lockable warden hook and is triggered automatically after the user signs in. The new model method is an extraction to allow you to override it in the application to implement things like switching to a write database if you're using the new multi-DB infrastructure from Rails for example, similar to how it's already possible with `Trackable#update_tracked_fields!`.
|
||||
* Add support for Ruby 3.
|
||||
* Add support for Rails 6.1.
|
||||
* Move CI to GitHub Actions.
|
||||
|
||||
* deprecations
|
||||
* `Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION` is deprecated in favor of `Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION` (@hanachin)
|
||||
|
||||
### 4.7.3 - 2020-09-20
|
||||
|
||||
* bug fixes
|
||||
* Do not modify `:except` option given to `#serializable_hash`. (by @dpep)
|
||||
* Fix thor deprecation when running the devise generator. (by @deivid-rodriguez)
|
||||
* Fix hanging tests for streaming controllers using Devise. (by @afn)
|
||||
|
||||
### 4.7.2 - 2020-06-10
|
||||
|
||||
* enhancements
|
||||
* Increase default stretches to 12 (by @sergey-alekseev)
|
||||
* Ruby 2.7 support (kwarg warnings removed)
|
||||
|
||||
* bug fixes
|
||||
* Generate scoped views with proper scoped errors partial (by @shobhitic)
|
||||
* Allow to set scoped `already_authenticated` error messages (by @gurgelrenan)
|
||||
|
||||
### 4.7.1 - 2019-09-06
|
||||
|
||||
* bug fixes
|
||||
* Fix an edge case where records with a blank `confirmation_token` could be confirmed (by @tegon)
|
||||
* Fix typo inside `update_needs_confirmation` i18n key (by @lslm)
|
||||
|
||||
### 4.7.0 - 2019-08-19
|
||||
|
||||
* enhancements
|
||||
* Support Rails 6.0
|
||||
* Update CI to rails 6.0.0.beta3 (by @tunnes)
|
||||
* refactor method name to be more consistent (by @saiqulhaq)
|
||||
* Fix rails 6.0.rc1 email uniqueness validation deprecation warning (by @Vasfed)
|
||||
|
||||
* bug fixes
|
||||
* Add `autocomplete="new-password"` to `password_confirmation` fields (by @ferrl)
|
||||
* Fix rails_51_and_up? method for Rails 6.rc1 (by @igorkasyanchuk)
|
||||
|
||||
### 4.6.2 - 2019-03-26
|
||||
|
||||
* bug fixes
|
||||
* Revert "Set `encrypted_password` to `nil` when `password` is set to `nil`" since it broke backward compatibility with existing applications. See more on https://github.com/heartcombo/devise/issues/5033#issuecomment-476386275 (by @mracos)
|
||||
|
||||
### 4.6.1 - 2019-02-11
|
||||
|
||||
* bug fixes
|
||||
* Check if `root_path` is defined with `#respond_to?` instead of `#present` (by @tegon)
|
||||
|
||||
### 4.6.0 - 2019-02-07
|
||||
|
||||
* enhancements
|
||||
* Allow to skip email and password change notifications (by @iorme1)
|
||||
* Include the use of `nil` for `allow_unconfirmed_access_for` in the docs (by @joaumg)
|
||||
* Ignore useless files into the `.gem` file (by @huacnlee)
|
||||
* Explain the code that prevents enumeration attacks inside `Devise::Strategies::DatabaseAuthenticatable` (by @tegon)
|
||||
* Refactor the `devise_error_messages!` helper to render a partial (by @prograhamer)
|
||||
* Add an option (`Devise.sign_in_after_change_password`) to not automatically sign in a user after changing a password (by @knjko)
|
||||
|
||||
* bug fixes
|
||||
* Fix missing comma in Simple Form generator (by @colinross)
|
||||
* Fix error with migration generator in Rails 6 (by @oystersauce8)
|
||||
* Set `encrypted_password` to `nil` when `password` is set to `nil` (by @sivagollapalli)
|
||||
* Consider whether the request supports flash messages inside `Devise::Controllers::Helpers#is_flashing_format?` (by @colinross)
|
||||
* Fix typo inside `Devise::Generators::ControllersGenerator` (by @kopylovvlad)
|
||||
* Sanitize parameters inside `Devise::Models::Authenticatable#find_or_initialize_with_errors` (by @rlue)
|
||||
* `#after_database_authentication` callback was not called after authentication on password reset (by @kanmaniselvan)
|
||||
* Fix corner case when `#confirmation_period_valid?` was called at the same second as `confirmation_sent_at` was set. Mostly true for date types that only have second precisions. (by @stanhu)
|
||||
* Fix unclosed `li` tag in `error_messages` partial (by @mracos)
|
||||
* Fix Routes issue when devise engine is mounted in another engine on Rails versions lower than 5.1 (by @a-barbieri)
|
||||
* Make `#increment_failed_attempts` concurrency safe (by @tegon)
|
||||
* Apply Test Helper fix to Rails 6.0 as well as 5.x (by @matthewrudy)
|
||||
|
||||
|
||||
* deprecations
|
||||
* The second argument of `DatabaseAuthenticatable`'s `#update_with_password` and `#update_without_password` is deprecated and will be removed in the next major version. It was added to support a feature deprecated in Rails 4, so you can safely remove it from your code. (by @ihatov08)
|
||||
* The `DeviseHelper.devise_error_messages!` is deprecated and will be removed in the next major version. Use the `devise/shared/error_messages` partial instead. (by @mracos)
|
||||
|
||||
### 4.5.0 - 2018-08-15
|
||||
|
||||
* enhancements
|
||||
* Use `before_action` instead of `before_filter` (by @edenthecat)
|
||||
* Allow people to extend devise failure app, through invoking `ActiveSupport.run_load_hooks` once `Devise::FailureApp` is loaded (by @wnm)
|
||||
* Use `update` instead of `update_attributes` (by @koic)
|
||||
* Split IP resolution from `update_tracked_fields` (by @mckramer)
|
||||
* upgrade dependencies for rails and responders (by @lancecarlson)
|
||||
* Add `autocomplete="new-password"` to new password fields (by @gssbzn)
|
||||
* Add `autocomplete="current-password"` to current password fields (by @gssbzn)
|
||||
* Remove redundant `self` from `database_authenticatable` module (by @abhishekkanojia)
|
||||
* Update `simple_form` templates with changes from https://github.com/heartcombo/devise/commit/16b3d6d67c7e017d461ea17ed29ea9738dc77e83 and https://github.com/heartcombo/devise/commit/6260c29a867b9a656f1e1557abe347a523178fab (by @gssbzn)
|
||||
* Remove `:trackable` from the default modules in the generators, to be more GDPR-friendly (by @fakenine)
|
||||
|
||||
* bug fixes
|
||||
* Use same string on failed login regardless of whether account exists when in paranoid mode (by @TonyMK9068)
|
||||
* Fix error when params is not a hash inside `Devise::ParameterSanitizer` (by @b0nn1e)
|
||||
* Look for `secret_key_base` inside `Rails.application` (by @gencer)
|
||||
* Ensure `Devise::ParameterFilter` does not add missing keys when called with a hash that has a `default` / `default_proc`
|
||||
configured (by @joshpencheon)
|
||||
* Adds `is_navigational_format?` check to `after_sign_up_path_for` to keep consistency (by @iorme1)
|
||||
|
||||
### 4.4.3 - 2018-03-17
|
||||
|
||||
* bug fixes
|
||||
* Fix undefined method `rails5?` for Devise::Test:Module (by @tegon)
|
||||
* Fix: secret key was being required to be set inside credentials on Rails 5.2 (by @tegon)
|
||||
|
||||
### 4.4.2 - 2018-03-15
|
||||
|
||||
* enhancements
|
||||
* Support for :credentials on Rails v5.2.x. (by @gencer)
|
||||
* Improve documentation about the test suite. (by @tegon)
|
||||
* Test with Rails 5.2.rc1 on Travis. (by @jcoyne)
|
||||
* Allow test with Rails 6. (by @Fudoshiki)
|
||||
* Creating a new section for controller configuration on `devise.rb` template (by @Danilo-Araujo-Silva)
|
||||
|
||||
* bug fixes
|
||||
* Preserve content_type for unauthenticated tests (by @gmcnaughton)
|
||||
* Check if the resource is persisted in `update_tracked_fields!` instead of performing validations (by @tegon)
|
||||
* Revert "Replace log_process_action to append_info_to_payload" (by @tegon)
|
||||
|
||||
### 4.4.1 - 2018-01-23
|
||||
|
||||
* bug fixes
|
||||
* Ensure Gemspec is loaded as utf-8. (by @segiddins)
|
||||
* Fix `ActiveRecord` check on `Confirmable`. (by @tegon)
|
||||
* Fix `signed_in?` docs without running auth hooks. by (@machty)
|
||||
|
||||
### 4.4.0 - 2017-12-29
|
||||
|
||||
* enhancements
|
||||
* Add `frozen_string_literal` pragma comment to all Ruby files. (by @pat)
|
||||
* Use `set_flash_method!` instead of `set_flash_method` in `Devise::OmniauthCallbacksController#failure`. (by @saichander17)
|
||||
* Clarify how `store_location_for` modifies URIs. (by @olivierlacan)
|
||||
* Move `failed_attempts` increment into its own function. by (@mobilutz)
|
||||
* Add `autocomplete="email"` to email fields. by (@MikeRogers0)
|
||||
* Add the ability to change the default migrations path introduced in Rails 5.0.3. (by @alexhifer)
|
||||
* Delete unnecessary condition for helper method. (by @davydovanton)
|
||||
* Support `id: :uuid` option for migrations. (by @filip373)
|
||||
|
||||
* bug fixes
|
||||
* Fix syntax for MRI 2.5.0. (by @pat)
|
||||
* Validations were being ignored on singup in the `Trackable#update_tracked_fields!` method. (by @AshleyFoster)
|
||||
* Do not modify options for `#serializable_hash`. (by @guigs)
|
||||
* Email confirmations were being sent on sign in/sign out for application using `mongoid` and `mongoid-paperclip` gems. This is because previously we were checking if a model is from Active Record by checking if the method `after_commit` was defined - since `mongoid` doesn' have one - but `mongoid-paperclip` gem does define one, which cause this issue. (by @fjg)
|
||||
|
||||
### 4.3.0 - 2017-05-14
|
||||
|
||||
* Enhancements
|
||||
* Dependency support added for Rails 5.1.x.
|
||||
|
||||
### 4.2.1 - 2017-03-15
|
||||
|
||||
* removals
|
||||
* `Devise::Mailer#scope_name` and `Devise::Mailer#resource` are now protected
|
||||
methods instead of public.
|
||||
* bug fixes
|
||||
* Attempt to reset password without the password field in the request now results in a `:blank` validation error.
|
||||
Before this change, Devise would accept the reset password request and log the user in, without validating/changing
|
||||
the password. (by @victor-am)
|
||||
* Confirmation links now expire based on UTC time, working properly when using different timezones. (by @jjuliano)
|
||||
* enhancements
|
||||
* Notify the original email when it is changed with a new `Devise.send_email_changed_notification` setting.
|
||||
When using `reconfirmable`, the notification will be sent right away instead of when the unconfirmed email is confirmed.
|
||||
(original change by @ethirajsrinivasan)
|
||||
|
||||
### 4.2.0 - 2016-07-01
|
||||
|
||||
* removals
|
||||
* Remove the deprecated `Devise::ParameterSanitizer` API from Devise 3.
|
||||
Please use the `#permit` and `#sanitize` methods over `#for`.
|
||||
* Remove the deprecated OmniAuth URL helpers. Use the fully qualified helpers
|
||||
(`user_facebook_omniauth_authorize_path`) over the scope based helpers
|
||||
( `user_omniauth_authorize_path(:facebook)`).
|
||||
* Remove the `Devise.bcrypt` method, use `Devise::Encryptor.digest` instead.
|
||||
* Remove the `Devise::Models::Confirmable#confirm!` method, use `confirm` instead.
|
||||
* Remove the `Devise::Models::Recoverable#reset_password!` method, use `reset_password` instead.
|
||||
* Remove the `Devise::Models::Recoverable#after_password_reset` method.
|
||||
* bug fixes
|
||||
* Fix an `ActionDispatch::IllegalStateError` when testing controllers with Rails 5 rc 2(by @hamadata).
|
||||
* Use `ActiveSupport.on_load` hooks to include Devise on `ActiveRecord` and `Mongoid`,
|
||||
avoiding autoloading these constants too soon (by @lucasmazza, @rafaelfranca).
|
||||
* enhancements
|
||||
* Display the minimum password length on `registrations/edit` view (by @Yanchek99).
|
||||
* You can disable Devise's routes reloading on boot by through the `reload_routes = false` config.
|
||||
This can reduce the time taken to boot the application but it might trigger
|
||||
some errors if you application (mostly your controllers) requires that
|
||||
Devise mappings be loaded during boot time (by @sidonath).
|
||||
* Added `Devise::Test::IntegrationHelpers` to bypass the sign in process using
|
||||
Warden test API (by @lucasmazza).
|
||||
* Define `inspect` in `Devise::Models::Authenticatable` to help ensure password hashes
|
||||
aren't included in exceptions or otherwise accidentally serialized (by @tkrajcar).
|
||||
* Add missing support of `Rails.application.config.action_controller.relative_url_root` (by @kosdiamantis).
|
||||
* deprecations
|
||||
* `Devise::TestHelpers` is deprecated in favor of `Devise::Test::ControllerHelpers`
|
||||
(by @lucasmazza).
|
||||
* The `sign_in` test helper has changed to use keyword arguments when passing
|
||||
a scope. `sign_in :admin, users(:alice)` should be rewritten as
|
||||
`sign_in users(:alice), scope: :admin` (by @lucasmazza).
|
||||
* The option `bypass` of `Devise::Controllers::SignInOut#sign_in` method is
|
||||
deprecated in favor of `Devise::Controllers::SignInOut#bypass_sign_in`
|
||||
method (by @ulissesalmeida).
|
||||
|
||||
### 4.1.1 - 2016-05-15
|
||||
|
||||
* bug fixes
|
||||
* Fix overwriting the remember_token when a valid one already exists (by @ralinchimev).
|
||||
|
||||
### 4.1.0
|
||||
|
||||
* bug fixes
|
||||
* Fix race condition of sending the confirmation instructions e-mail using background jobs.
|
||||
Using the previous `after_create` callback, the e-mail can be sent before
|
||||
the record be committed on database, generating a `ActiveRecord::NotFound` error.
|
||||
Now the confirmation e-mail will be only sent after the database commit,
|
||||
using the `after_commit` callback.
|
||||
It may break your test suite on Rails 4 if you are testing the sent e-mails
|
||||
or enqueued jobs using transactional fixtures enabled or `DatabaseCleaner` with `transaction` strategy.
|
||||
You can easily fix your test suite using the gem
|
||||
[test_after_commit](https://github.com/grosser/test_after_commit). For example, put in your Gemfile:
|
||||
|
||||
```ruby
|
||||
gem 'test_after_commit', :group => :test
|
||||
```
|
||||
|
||||
On Rails 5 `after_commit` callbacks are triggered even using transactional
|
||||
fixtures, then this fix will not break your test suite. If you are using `DatabaseCleaner` with the `deletion` or `truncation` strategies it may not break your tests. (by @allenwq)
|
||||
* Fix strategy checking in `Lockable#unlock_strategy_enabled?` for `:none` and
|
||||
`:undefined` strategies. (by @f3ndot)
|
||||
* features
|
||||
* Humanize authentication keys in failure flash message (by @byzg)
|
||||
When you are configuring the translations of `devise.failure.invalid`, the
|
||||
`authentication_keys` is translated now.
|
||||
* deprecations
|
||||
* Remove code supporting old session serialization format (by @fphilipe).
|
||||
* Now the `email_regexp` default uses a more permissive regex:
|
||||
`/\A[^@\s]+@[^@\s]+\z/` (by @kimgb)
|
||||
* Now the `strip_whitespace_keys` default is `[:email]` (by @ulissesalmeida)
|
||||
* Now the `reconfirmable` default is `true` (by @ulissesalmeida)
|
||||
* Now the `skip_session_storage` default is `[:http_auth]` (by @ulissesalmeida)
|
||||
* Now the `sign_out_via` default is `:delete` (by @ulissesalmeida)
|
||||
* improvements
|
||||
* Avoids extra computation of friendly token for confirmation token (by @sbc100)
|
||||
|
||||
### 4.0.3 - 2016-05-15
|
||||
|
||||
* bug fixes
|
||||
* Fix overwriting the remember_token when a valid one already exists (by @ralinchimev).
|
||||
|
||||
### 4.0.2 - 2016-05-02
|
||||
|
||||
* bug fixes
|
||||
* Fix strategy checking in `Lockable#unlock_strategy_enabled?` for `:none`
|
||||
and `:undefined` strategies. (by @f3ndot)
|
||||
|
||||
### 4.0.1 - 2016-04-25
|
||||
|
||||
@@ -37,11 +361,11 @@
|
||||
|
||||
* deprecations
|
||||
* omniauth routes are no longer defined with a wildcard `:provider` parameter,
|
||||
and provider specific routes are defined instead, so route helpers like `user_omniauth_authorize_path(:github)` are deprecated in favor of `user_github_authorize_path`.
|
||||
and provider specific routes are defined instead, so route helpers like `user_omniauth_authorize_path(:github)` are deprecated in favor of `user_github_omniauth_authorize_path`.
|
||||
You can still use `omniauth_authorize_path(:user, :github)` if you need to
|
||||
call the helpers dynamically.
|
||||
|
||||
### 4.0.0.rc1 - 2016-01-02
|
||||
### 4.0.0.rc1 - 2016-02-01
|
||||
|
||||
* Support added to Rails 5 (by @twalpole).
|
||||
* Devise no longer supports Rails 3.2 and 4.0.
|
||||
@@ -79,8 +403,8 @@
|
||||
end
|
||||
```
|
||||
|
||||
You can check more examples and explanations on the [README section](/plataformatec/devise#strong-parameters)
|
||||
You can check more examples and explanations on the [README section](README.md#strong-parameters)
|
||||
and on the [ParameterSanitizer docs](lib/devise/parameter_sanitizer.rb).
|
||||
|
||||
Please check [3-stable](https://github.com/plataformatec/devise/blob/3-stable/CHANGELOG.md)
|
||||
Please check [3-stable](https://github.com/heartcombo/devise/blob/3-stable/CHANGELOG.md)
|
||||
for previous changes.
|
||||
|
||||
@@ -17,6 +17,6 @@ Project maintainers have the right and responsibility to remove, edit, or reject
|
||||
|
||||
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by sending an email to [conduct@plataformatec.com.br](conduct@plataformatec.com.br) or contacting one or more of the project maintainers.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by sending an email to [heartcombo@googlegroups.com](heartcombo@googlegroups.com) or contacting one or more of the project maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
||||
|
||||
@@ -1,16 +1,79 @@
|
||||
### Please read before contributing
|
||||
# How to contribute to Devise
|
||||
|
||||
1) Do not post questions in the issues tracker. If you have any questions about Devise, search the [Wiki](https://github.com/plataformatec/devise/wiki) or use the [Mailing List](https://groups.google.com/group/plataformatec-devise) or [Stack Overflow](http://stackoverflow.com/questions/tagged/devise).
|
||||
Thanks for your interest on contributing to Devise! Here are a few general
|
||||
guidelines on contributing and reporting bugs to Devise that we ask you to
|
||||
take a look first. Notice that all of your interactions in the project are
|
||||
expected to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||
|
||||
2) If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to [opensource@plataformatec.com.br](mailto:opensource@plataformatec.com.br) instead.
|
||||
## Reporting Issues
|
||||
|
||||
3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
|
||||
Before reporting a new issue, please be sure that the issue wasn't already
|
||||
reported or fixed by searching on GitHub through our [issues](https://github.com/heartcombo/devise/issues).
|
||||
|
||||
4) When reporting an issue, include Rails, Devise and Warden versions. If you are getting exceptions, please include the full backtrace.
|
||||
When creating a new issue, be sure to include a **title and clear description**,
|
||||
as much relevant information as possible, and either a test case example or
|
||||
even better a **sample Rails app that replicates the issue** - Devise has a lot
|
||||
of moving parts and it's functionality can be affected by third party gems, so
|
||||
we need as much context and details as possible to identify what might be broken
|
||||
for you. We have a [test case template](guides/bug_report_templates/integration_test.rb)
|
||||
that can be used to replicate issues with minimal setup.
|
||||
|
||||
5) Notice that all of your interactions in the project are expected to follow our [Code of Conduct](CODE_OF_CONDUCT.md)
|
||||
Please do not attempt to translate Devise built in views. The views are meant
|
||||
to be a starting point for fresh apps and not production material - eventually
|
||||
all applications will require custom views where you can write your own copy and
|
||||
translate it if the application requires it . For historical references, please look into closed
|
||||
[Issues/Pull Requests](https://github.com/heartcombo/devise/issues?q=i18n) regarding
|
||||
internationalization.
|
||||
|
||||
That's it! The more information you give, the easier it becomes for us to track it down and fix it.
|
||||
Ideally, you should provide an application that reproduces the error or a test case to Devise's suite.
|
||||
Avoid opening new issues to ask questions in our issues tracker. Please go through
|
||||
the project wiki, documentation and source code first, or try to ask your question
|
||||
on [Stack Overflow](http://stackoverflow.com/questions/tagged/devise).
|
||||
|
||||
Thanks!
|
||||
**If you find a security bug, do not report it through GitHub. Please send an
|
||||
e-mail to [heartcombo@googlegroups.com](mailto:heartcombo@googlegroups.com)
|
||||
instead.**
|
||||
|
||||
## Sending Pull Requests
|
||||
|
||||
Before sending a new Pull Request, take a look on existing Pull Requests and Issues
|
||||
to see if the proposed change or fix has been discussed in the past, or if the
|
||||
change was already implemented but not yet released.
|
||||
|
||||
We expect new Pull Requests to include enough tests for new or changed behavior,
|
||||
and we aim to maintain everything as most backwards compatible as possible,
|
||||
reserving breaking changes to be ship in major releases when necessary - you
|
||||
can wrap the new code path with a setting toggle from the `Devise` module defined
|
||||
as `false` by default to require developers to opt-in for the new behavior.
|
||||
|
||||
If your Pull Request includes new or changed behavior, be sure that the changes
|
||||
are beneficial to a wide range of use cases or it's an application specific change
|
||||
that might not be so valuable to other applications. Some changes can be introduced
|
||||
as a new `devise-something` gem instead of belonging to the main codebase.
|
||||
|
||||
When adding new settings, you can take advantage of the [`Devise::Models.config`](https://github.com/heartcombo/devise/blob/245b1f9de0b3386b7913e14b60ea24f43b77feb0/lib/devise/models.rb#L13-L50) method to add class and instance level fallbacks
|
||||
to the new setting.
|
||||
|
||||
We also welcome Pull Requests that improve our existing documentation (both our
|
||||
`README.md` and the RDoc sections in the source code) or improve existing rough
|
||||
edges in our API that might be blocking existing integrations or 3rd party gems.
|
||||
|
||||
## Other ways to contribute
|
||||
|
||||
We welcome anyone that wants to contribute to Devise to triage and reply to
|
||||
open issues to help troubleshoot and fix existing bugs on Devise. Here is what
|
||||
you can do:
|
||||
|
||||
* Help ensure that existing issues follows the recommendations from the
|
||||
_[Reporting Issues](#reporting-issues)_ section, providing feedback to the issue's
|
||||
author on what might be missing.
|
||||
* Review and update the existing content of our [Wiki](https://github.com/heartcombo/devise/wiki)
|
||||
with up to date instructions and code samples - the wiki was grown with several
|
||||
different tutorials and references that we can't keep track of everything, so if
|
||||
there is a page that showcases an integration or customization that you are
|
||||
familiar with feel free to update it as necessary.
|
||||
* Review existing Pull Requests, and testing patches against real existing
|
||||
applications that use Devise.
|
||||
|
||||
Thanks again for your interest on contributing to the project!
|
||||
|
||||
:heart:
|
||||
|
||||
39
Gemfile
39
Gemfile
@@ -1,29 +1,38 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
||||
gem "rails", "~> 4.2.6"
|
||||
gem "omniauth", "~> 1.3"
|
||||
gem "omniauth-oauth2", "~> 1.4"
|
||||
gem "rails", "~> 7.1.0"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid", "~> 1.0.1"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3"
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 5.0"
|
||||
end
|
||||
# platforms :jruby do
|
||||
# gem "activerecord-jdbc-adapter"
|
||||
# gem "activerecord-jdbcsqlite3-adapter"
|
||||
# gem "jruby-openssl"
|
||||
# end
|
||||
|
||||
# TODO:
|
||||
# group :mongoid do
|
||||
# gem "mongoid", "~> 4.0.0"
|
||||
# end
|
||||
|
||||
382
Gemfile.lock
382
Gemfile.lock
@@ -1,179 +1,271 @@
|
||||
GIT
|
||||
remote: https://github.com/rails/rails-controller-testing.git
|
||||
revision: c203673f8011a7cdc2a8edf995ae6b3eec3417ca
|
||||
specs:
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
devise (4.0.1)
|
||||
devise (4.9.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0, < 5.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
actioncable (7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
activejob (= 7.1.0)
|
||||
activerecord (= 7.1.0)
|
||||
activestorage (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
mail (>= 2.7.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailer (7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
actionview (= 7.1.0)
|
||||
activejob (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.1.0)
|
||||
actionview (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
rack (>= 2.2.4)
|
||||
rack-session (>= 1.0.1)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
actiontext (7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
activerecord (= 7.1.0)
|
||||
activestorage (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
activejob (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.6)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
arel (6.0.3)
|
||||
bcrypt (3.1.11)
|
||||
bson (4.0.0)
|
||||
builder (3.2.2)
|
||||
concurrent-ruby (1.0.1)
|
||||
erubis (2.7.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
hashie (3.4.3)
|
||||
i18n (0.7.0)
|
||||
json (1.8.3)
|
||||
jwt (1.5.1)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
metaclass (0.0.4)
|
||||
mime-types (2.99.1)
|
||||
mini_portile2 (2.0.0)
|
||||
minitest (5.8.4)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mongo (2.2.0)
|
||||
bson (~> 4.0)
|
||||
mongoid (5.0.1)
|
||||
activemodel (~> 4.0)
|
||||
mongo (~> 2.1)
|
||||
origin (~> 2.1)
|
||||
tzinfo (>= 0.3.37)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
oauth2 (1.1.0)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 1.0, < 1.5.2)
|
||||
multi_json (~> 1.3)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activejob (7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
activerecord (7.1.0)
|
||||
activemodel (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
activejob (= 7.1.0)
|
||||
activerecord (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.1.0)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
base64 (0.1.1)
|
||||
bcrypt (3.1.19)
|
||||
bigdecimal (3.1.4)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.2.2)
|
||||
connection_pool (2.4.1)
|
||||
crass (1.0.6)
|
||||
date (3.3.3)
|
||||
drb (2.1.1)
|
||||
ruby2_keywords
|
||||
erubi (1.12.0)
|
||||
faraday (2.7.11)
|
||||
base64
|
||||
faraday-net_http (>= 2.0, < 3.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-net_http (3.0.2)
|
||||
globalid (1.2.1)
|
||||
activesupport (>= 6.1)
|
||||
hashie (5.0.0)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
io-console (0.6.0)
|
||||
irb (1.8.1)
|
||||
rdoc
|
||||
reline (>= 0.3.8)
|
||||
jwt (2.7.1)
|
||||
loofah (2.21.3)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
mail (2.8.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
marcel (1.0.2)
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.4)
|
||||
minitest (5.20.0)
|
||||
mocha (2.1.0)
|
||||
ruby2_keywords (>= 0.0.5)
|
||||
multi_xml (0.6.0)
|
||||
mutex_m (0.1.2)
|
||||
net-imap (0.4.1)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
net-protocol
|
||||
net-protocol (0.2.1)
|
||||
timeout
|
||||
net-smtp (0.4.0)
|
||||
net-protocol
|
||||
nio4r (2.5.9)
|
||||
nokogiri (1.15.4)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
oauth2 (2.0.9)
|
||||
faraday (>= 0.17.3, < 3.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.3.1)
|
||||
hashie (>= 1.2, < 4)
|
||||
rack (>= 1.0, < 3)
|
||||
omniauth-facebook (3.0.0)
|
||||
rack (>= 1.2, < 4)
|
||||
snaky_hash (~> 2.0)
|
||||
version_gem (~> 1.1)
|
||||
omniauth (2.1.1)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 2.2.3)
|
||||
rack-protection
|
||||
omniauth-facebook (9.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.4.0)
|
||||
oauth2 (~> 1.0)
|
||||
omniauth (~> 1.2)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
origin (2.2.0)
|
||||
omniauth-oauth2 (1.8.0)
|
||||
oauth2 (>= 1.4, < 3)
|
||||
omniauth (~> 2.0)
|
||||
omniauth-openid (2.0.1)
|
||||
omniauth (>= 1.0, < 3.0)
|
||||
rack-openid (~> 1.4.0)
|
||||
orm_adapter (0.5.0)
|
||||
rack (1.6.4)
|
||||
rack-openid (1.3.1)
|
||||
psych (5.1.0)
|
||||
stringio
|
||||
racc (1.7.1)
|
||||
rack (2.2.8)
|
||||
rack-openid (1.4.2)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.2.6)
|
||||
actionmailer (= 4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activerecord (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.6)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
railties (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (11.0.1)
|
||||
rdoc (4.2.2)
|
||||
json (~> 1.4)
|
||||
responders (2.1.2)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
ruby-openid (2.7.0)
|
||||
sprockets (3.5.2)
|
||||
rack-protection (3.1.0)
|
||||
rack (~> 2.2, >= 2.2.4)
|
||||
rack-session (1.0.1)
|
||||
rack (< 3)
|
||||
rack-test (2.1.0)
|
||||
rack (>= 1.3)
|
||||
rackup (1.0.0)
|
||||
rack (< 3)
|
||||
webrick
|
||||
rails (7.1.0)
|
||||
actioncable (= 7.1.0)
|
||||
actionmailbox (= 7.1.0)
|
||||
actionmailer (= 7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
actiontext (= 7.1.0)
|
||||
actionview (= 7.1.0)
|
||||
activejob (= 7.1.0)
|
||||
activemodel (= 7.1.0)
|
||||
activerecord (= 7.1.0)
|
||||
activestorage (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.1.0)
|
||||
rails-dom-testing (2.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.6.0)
|
||||
loofah (~> 2.21)
|
||||
nokogiri (~> 1.14)
|
||||
railties (7.1.0)
|
||||
actionpack (= 7.1.0)
|
||||
activesupport (= 7.1.0)
|
||||
irb
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
zeitwerk (~> 2.6)
|
||||
rake (13.0.6)
|
||||
rdoc (6.5.0)
|
||||
psych (>= 4.0.0)
|
||||
reline (0.3.9)
|
||||
io-console (~> 0.5)
|
||||
responders (3.1.0)
|
||||
actionpack (>= 5.2)
|
||||
railties (>= 5.2)
|
||||
rexml (3.2.6)
|
||||
ruby-openid (2.9.2)
|
||||
ruby2_keywords (0.0.5)
|
||||
snaky_hash (2.0.1)
|
||||
hashie
|
||||
version_gem (~> 1.1, >= 1.1.1)
|
||||
sqlite3 (1.6.6)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
stringio (3.0.8)
|
||||
thor (1.2.2)
|
||||
timecop (0.9.8)
|
||||
timeout (0.4.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.0.4)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.11)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.6)
|
||||
rack (>= 1.0)
|
||||
version_gem (1.1.3)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
webrick (1.8.1)
|
||||
websocket-driver (0.7.6)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.6.12)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-jdbc-adapter
|
||||
activerecord-jdbcsqlite3-adapter
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
mongoid (~> 5.0)
|
||||
omniauth (~> 1.3)
|
||||
mocha (~> 2.1)
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-oauth2 (~> 1.4)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
rails (~> 4.2.6)
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
rails (~> 7.1.0)
|
||||
rails-controller-testing!
|
||||
rdoc
|
||||
sqlite3
|
||||
responders (~> 3.1)
|
||||
rexml
|
||||
sqlite3 (~> 1.4)
|
||||
timecop
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.11.2
|
||||
2.4.5
|
||||
|
||||
20
ISSUE_TEMPLATE.md
Normal file
20
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,20 @@
|
||||
## Pre-check
|
||||
|
||||
- Do not use the issues tracker for help or support, try Stack Overflow.
|
||||
- For bugs, do a quick search and make sure the bug has not yet been reported
|
||||
- If you found a security bug, do not report it through GitHub. Please send an e-mail to heartcombo@googlegroups.com instead.
|
||||
- Finally, be nice and have fun!
|
||||
|
||||
## Environment
|
||||
|
||||
- Ruby **[version]**
|
||||
- Rails **[version]**
|
||||
- Devise **[version]**
|
||||
|
||||
## Current behavior
|
||||
|
||||
Include code samples, errors, steps to reproduce the error and stack traces if appropriate.
|
||||
|
||||
Will be even more helpful if you provide a sample application or a test case that reproduces the error.
|
||||
|
||||
## Expected behavior
|
||||
@@ -1,4 +1,5 @@
|
||||
Copyright 2009-2016 Plataformatec. http://plataformatec.com.br
|
||||
Copyright 2020-2024 Rafael França, Leonardo Tegon, Carlos Antônio da Silva.
|
||||
Copyright 2009-2019 Plataformatec.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
407
README.md
407
README.md
@@ -1,11 +1,4 @@
|
||||

|
||||
|
||||
By [Plataformatec](http://plataformatec.com.br/).
|
||||
|
||||
[](http://travis-ci.org/plataformatec/devise)
|
||||
[](https://codeclimate.com/github/plataformatec/devise)
|
||||
|
||||
This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/).
|
||||

|
||||
|
||||
Devise is a flexible authentication solution for Rails based on Warden. It:
|
||||
|
||||
@@ -16,16 +9,55 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
|
||||
|
||||
It's composed of 10 modules:
|
||||
|
||||
* [Database Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
|
||||
* [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/intridea/omniauth) support.
|
||||
* [Confirmable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
|
||||
* [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
|
||||
* [Registerable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
|
||||
* [Rememberable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
|
||||
* [Trackable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
|
||||
* [Timeoutable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
|
||||
* [Validatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Validatable): provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
|
||||
* [Lockable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Lockable): locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
|
||||
* [Database Authenticatable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/DatabaseAuthenticatable): hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
|
||||
* [Omniauthable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
|
||||
* [Confirmable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
|
||||
* [Recoverable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Recoverable): resets the user password and sends reset instructions.
|
||||
* [Registerable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
|
||||
* [Rememberable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
|
||||
* [Trackable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
|
||||
* [Timeoutable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
|
||||
* [Validatable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Validatable): provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
|
||||
* [Lockable](http://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Lockable): locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 orderedList:0 -->
|
||||
|
||||
- [Information](#information)
|
||||
- [The Devise wiki](#the-devise-wiki)
|
||||
- [Bug reports](#bug-reports)
|
||||
- [StackOverflow and Mailing List](#stackoverflow-and-mailing-list)
|
||||
- [RDocs](#rdocs)
|
||||
- [Example applications](#example-applications)
|
||||
- [Extensions](#extensions)
|
||||
- [Contributing](#contributing)
|
||||
- [Starting with Rails?](#starting-with-rails)
|
||||
- [Getting started](#getting-started)
|
||||
- [Controller filters and helpers](#controller-filters-and-helpers)
|
||||
- [Configuring Models](#configuring-models)
|
||||
- [Strong Parameters](#strong-parameters)
|
||||
- [Configuring views](#configuring-views)
|
||||
- [Configuring controllers](#configuring-controllers)
|
||||
- [Configuring routes](#configuring-routes)
|
||||
- [I18n](#i18n)
|
||||
- [Test helpers](#test-helpers)
|
||||
- [Controller tests](#controller-tests)
|
||||
- [Integration tests](#integration-tests)
|
||||
- [OmniAuth](#omniauth)
|
||||
- [Configuring multiple models](#configuring-multiple-models)
|
||||
- [Active Job Integration](#active-job-integration)
|
||||
- [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
|
||||
- [Other ORMs](#other-orms)
|
||||
- [Rails API mode](#rails-api-mode)
|
||||
- [Additional information](#additional-information)
|
||||
- [Warden](#warden)
|
||||
- [Contributors](#contributors)
|
||||
- [License](#license)
|
||||
|
||||
<!-- /TOC -->
|
||||
|
||||
|
||||
|
||||
## Information
|
||||
|
||||
@@ -33,19 +65,23 @@ It's composed of 10 modules:
|
||||
|
||||
The Devise Wiki has lots of additional information about Devise including many "how-to" articles and answers to the most frequently asked questions. Please browse the Wiki after finishing this README:
|
||||
|
||||
https://github.com/plataformatec/devise/wiki
|
||||
https://github.com/heartcombo/devise/wiki
|
||||
|
||||
### Bug reports
|
||||
|
||||
If you discover a problem with Devise, we would like to know about it. However, we ask that you please review these guidelines before submitting a bug report:
|
||||
|
||||
https://github.com/plataformatec/devise/wiki/Bug-reports
|
||||
https://github.com/heartcombo/devise/wiki/Bug-reports
|
||||
|
||||
If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to opensource@plataformatec.com.br.
|
||||
If you have discovered a security related bug, please do *NOT* use the GitHub issue tracker. Send an email to heartcombo@googlegroups.com.
|
||||
|
||||
### Mailing list
|
||||
### StackOverflow and Mailing List
|
||||
|
||||
If you have any questions, comments, or concerns, please use the Google Group instead of the GitHub issue tracker:
|
||||
If you have any questions, comments, or concerns, please use StackOverflow instead of the GitHub issue tracker:
|
||||
|
||||
http://stackoverflow.com/questions/tagged/devise
|
||||
|
||||
The deprecated mailing list can still be read on
|
||||
|
||||
https://groups.google.com/group/plataformatec-devise
|
||||
|
||||
@@ -53,7 +89,7 @@ https://groups.google.com/group/plataformatec-devise
|
||||
|
||||
You can view the Devise documentation in RDoc format here:
|
||||
|
||||
http://rubydoc.info/github/plataformatec/devise/master/frames
|
||||
http://rubydoc.info/github/heartcombo/devise/main/frames
|
||||
|
||||
If you need to use Devise with previous versions of Rails, you can always run "gem server" from the command line after you install the gem to access the old documentation.
|
||||
|
||||
@@ -61,65 +97,115 @@ If you need to use Devise with previous versions of Rails, you can always run "g
|
||||
|
||||
There are a few example applications available on GitHub that demonstrate various features of Devise with different versions of Rails. You can view them here:
|
||||
|
||||
https://github.com/plataformatec/devise/wiki/Example-Applications
|
||||
https://github.com/heartcombo/devise/wiki/Example-Applications
|
||||
|
||||
### Extensions
|
||||
|
||||
Our community has created a number of extensions that add functionality above and beyond what is included with Devise. You can view a list of available extensions and add your own here:
|
||||
|
||||
https://github.com/plataformatec/devise/wiki/Extensions
|
||||
https://github.com/heartcombo/devise/wiki/Extensions
|
||||
|
||||
### Contributing
|
||||
|
||||
We hope that you will consider contributing to Devise. Please read this short overview for some information about how to get started:
|
||||
|
||||
https://github.com/plataformatec/devise/wiki/Contributing
|
||||
https://github.com/heartcombo/devise/wiki/Contributing
|
||||
|
||||
You will usually want to write tests for your changes. To run the test suite, go into Devise's top-level directory and run "bundle install" and "rake". For the tests to pass, you will need to have a MongoDB server (version 2.0 or newer) running on your system.
|
||||
You will usually want to write tests for your changes. To run the test suite, go into Devise's top-level directory and run `bundle install` and `bin/test`.
|
||||
Devise works with multiple Ruby and Rails versions, and ActiveRecord and Mongoid ORMs, which means you can run the test suite with some modifiers: `DEVISE_ORM` and `BUNDLE_GEMFILE`.
|
||||
|
||||
### DEVISE_ORM
|
||||
Since Devise supports both Mongoid and ActiveRecord, we rely on this variable to run specific code for each ORM.
|
||||
The default value of `DEVISE_ORM` is `active_record`. To run the tests for Mongoid, you can pass `mongoid`:
|
||||
```
|
||||
DEVISE_ORM=mongoid bin/test
|
||||
|
||||
==> Devise.orm = :mongoid
|
||||
```
|
||||
When running the tests for Mongoid, you will need to have a MongoDB server (version 2.0 or newer) running on your system.
|
||||
|
||||
Please note that the command output will show the variable value being used.
|
||||
|
||||
### BUNDLE_GEMFILE
|
||||
We can use this variable to tell bundler what Gemfile it should use (instead of the one in the current directory).
|
||||
Inside the [gemfiles](https://github.com/heartcombo/devise/tree/main/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite breaks using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
|
||||
For example, if the tests broke using Ruby 2.4.2 and Rails 4.1, you can do the following:
|
||||
```bash
|
||||
rbenv shell 2.4.2 # or rvm use 2.4.2
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bin/test
|
||||
```
|
||||
|
||||
You can also combine both of them if the tests broke for Mongoid:
|
||||
```bash
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
|
||||
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable DEVISE_ORM=mongoid bin/test
|
||||
```
|
||||
|
||||
### Running tests
|
||||
Devise uses [Mini Test](https://github.com/seattlerb/minitest) as test framework.
|
||||
|
||||
* Running all tests:
|
||||
```bash
|
||||
bin/test
|
||||
```
|
||||
|
||||
* Running tests for an specific file:
|
||||
```bash
|
||||
bin/test test/models/trackable_test.rb
|
||||
```
|
||||
|
||||
* Running a specific test given a regex:
|
||||
```bash
|
||||
bin/test test/models/trackable_test.rb:16
|
||||
```
|
||||
|
||||
## Starting with Rails?
|
||||
|
||||
If you are building your first Rails application, we recommend you *do not* use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch. Today, we have three resources that should help you get started:
|
||||
If you are building your first Rails application, we recommend you *do not* use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch. Here's a few resources that should help you get started:
|
||||
|
||||
* Michael Hartl's online book: https://www.railstutorial.org/book/modeling_users
|
||||
* Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch
|
||||
* Codecademy's Ruby on Rails: Authentication and Authorization: http://www.codecademy.com/en/learn/rails-auth
|
||||
* Ryan Bates' Railscasts: http://railscasts.com/episodes/250-authentication-from-scratch and http://railscasts.com/episodes/250-authentication-from-scratch-revised
|
||||
* Codecademy's Ruby on Rails: Authentication and Authorization: https://www.codecademy.com/learn/rails-auth
|
||||
|
||||
Once you have solidified your understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :smiley:
|
||||
|
||||
## Getting started
|
||||
|
||||
Devise 4.0 works with Rails 4.2 onwards. You can add it to your Gemfile with:
|
||||
Devise 4.0 works with Rails 4.1 onwards. Add the following line to your Gemfile:
|
||||
|
||||
```ruby
|
||||
gem 'devise'
|
||||
```
|
||||
|
||||
Run the bundle command to install it.
|
||||
Then run `bundle install`
|
||||
|
||||
After you install Devise and add it to your Gemfile, you need to run the generator:
|
||||
Next, you need to run the generator:
|
||||
|
||||
```console
|
||||
rails generate devise:install
|
||||
$ rails generate devise:install
|
||||
```
|
||||
|
||||
The generator will install an initializer which describes ALL of Devise's configuration options. It is *imperative* that you take a look at it. When you are done, you are ready to add Devise to any of your models using the generator:
|
||||
|
||||
```console
|
||||
rails generate devise MODEL
|
||||
```
|
||||
|
||||
Replace MODEL with the class name used for the application’s users (it’s frequently `User` but could also be `Admin`). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your `config/routes.rb` file to point to the Devise controller.
|
||||
|
||||
Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration. Then run `rake db:migrate`
|
||||
|
||||
Next, you need to set up the default URL options for the Devise mailer in each environment. Here is a possible configuration for `config/environments/development.rb`:
|
||||
At this point, a number of instructions will appear in the console. Among these instructions, you'll need to set up the default URL options for the Devise mailer in each environment. Here is a possible configuration for `config/environments/development.rb`:
|
||||
|
||||
```ruby
|
||||
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
||||
```
|
||||
|
||||
You should restart your application after changing Devise's configuration options. Otherwise, you will run into strange errors, for example, users being unable to login and route helpers being undefined.
|
||||
The generator will install an initializer which describes ALL of Devise's configuration options. It is *imperative* that you take a look at it. When you are done, you are ready to add Devise to any of your models using the generator.
|
||||
|
||||
|
||||
In the following command you will replace `MODEL` with the class name used for the application’s users (it’s frequently `User` but could also be `Admin`). This will create a model (if one does not exist) and configure it with the default Devise modules. The generator also configures your `config/routes.rb` file to point to the Devise controller.
|
||||
|
||||
```console
|
||||
$ rails generate devise MODEL
|
||||
```
|
||||
|
||||
Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration.
|
||||
|
||||
Then run `rails db:migrate`
|
||||
|
||||
You should restart your application after changing Devise's configuration options (this includes stopping spring). Otherwise, you will run into strange errors, for example, users being unable to login and route helpers being undefined.
|
||||
|
||||
### Controller filters and helpers
|
||||
|
||||
@@ -154,7 +240,7 @@ user_session
|
||||
After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect to. For instance, when using a `:user` resource, the `user_root_path` will be used if it exists; otherwise, the default `root_path` will be used. This means that you need to set the root inside your routes:
|
||||
|
||||
```ruby
|
||||
root to: "home#index"
|
||||
root to: 'home#index'
|
||||
```
|
||||
|
||||
You can also override `after_sign_in_path_for` and `after_sign_out_path_for` to customize your redirect hooks.
|
||||
@@ -176,16 +262,16 @@ member_session
|
||||
The Devise method in your models also accepts some options to configure its modules. For example, you can choose the cost of the hashing algorithm with:
|
||||
|
||||
```ruby
|
||||
devise :database_authenticatable, :registerable, :confirmable, :recoverable, stretches: 20
|
||||
devise :database_authenticatable, :registerable, :confirmable, :recoverable, stretches: 13
|
||||
```
|
||||
|
||||
Besides `:stretches`, you can define `:pepper`, `:encryptor`, `:confirm_within`, `:remember_for`, `:timeout_in`, `:unlock_in` among other options. For more details, see the initializer file that was created when you invoked the "devise:install" generator described above. This file is usually located at `/config/initializers/devise.rb`.
|
||||
|
||||
### Strong Parameters
|
||||
|
||||

|
||||
The Parameter Sanitizer API has changed for Devise 4 :warning:
|
||||
|
||||
*For previous Devise versions see https://github.com/plataformatec/devise/tree/3-stable#strong-parameters*
|
||||
*For previous Devise versions see https://github.com/heartcombo/devise/tree/3-stable#strong-parameters*
|
||||
|
||||
When you customize your own views, you may end up adding new attributes to forms. Rails 4 moved the parameter sanitization from the model to the controller, causing Devise to handle this concern at the controller as well.
|
||||
|
||||
@@ -195,7 +281,7 @@ There are just three actions in Devise that allow any set of parameters to be pa
|
||||
* `sign_up` (`Devise::RegistrationsController#create`) - Permits authentication keys plus `password` and `password_confirmation`
|
||||
* `account_update` (`Devise::RegistrationsController#update`) - Permits authentication keys plus `password`, `password_confirmation` and `current_password`
|
||||
|
||||
In case you want to permit additional parameters (the lazy way™), you can do so using a simple before filter in your `ApplicationController`:
|
||||
In case you want to permit additional parameters (the lazy way™), you can do so using a simple before action in your `ApplicationController`:
|
||||
|
||||
```ruby
|
||||
class ApplicationController < ActionController::Base
|
||||
@@ -209,7 +295,21 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
```
|
||||
|
||||
The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_attributes_for`), then you will need to tell devise about those nestings and types. Devise allows you to completely change Devise defaults or invoke custom behaviour by passing a block:
|
||||
The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_attributes_for`), then you will need to tell devise about those nestings and types:
|
||||
|
||||
```ruby
|
||||
class ApplicationController < ActionController::Base
|
||||
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||
|
||||
protected
|
||||
|
||||
def configure_permitted_parameters
|
||||
devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, address_attributes: [:country, :state, :city, :area, :postal_code]])
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Devise allows you to completely change Devise defaults or invoke custom behavior by passing a block:
|
||||
|
||||
To permit simple scalar values for username and email, use this
|
||||
|
||||
@@ -270,7 +370,7 @@ We built Devise to help you quickly develop an application that uses authenticat
|
||||
Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after some time you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
|
||||
|
||||
```console
|
||||
rails generate devise:views
|
||||
$ rails generate devise:views
|
||||
```
|
||||
|
||||
If you have more than one Devise model in your application (such as `User` and `Admin`), you will notice that Devise uses the same views for all models. Fortunately, Devise offers an easy way to customize views. All you need to do is set `config.scoped_views = true` inside the `config/initializers/devise.rb` file.
|
||||
@@ -278,14 +378,14 @@ If you have more than one Devise model in your application (such as `User` and `
|
||||
After doing so, you will be able to have views based on the role like `users/sessions/new` and `admins/sessions/new`. If no view is found within the scope, Devise will use the default view at `devise/sessions/new`. You can also use the generator to generate scoped views:
|
||||
|
||||
```console
|
||||
rails generate devise:views users
|
||||
$ rails generate devise:views users
|
||||
```
|
||||
|
||||
If you would like to generate only a few sets of views, like the ones for the `registerable` and `confirmable` module,
|
||||
you can pass a list of modules to the generator with the `-v` flag.
|
||||
you can pass a list of views to the generator with the `-v` flag.
|
||||
|
||||
```console
|
||||
rails generate devise:views -v registrations confirmations
|
||||
$ rails generate devise:views -v registrations confirmations
|
||||
```
|
||||
|
||||
### Configuring controllers
|
||||
@@ -295,7 +395,7 @@ If the customization at the views level is not enough, you can customize each co
|
||||
1. Create your custom controllers using the generator which requires a scope:
|
||||
|
||||
```console
|
||||
rails generate devise:controllers [scope]
|
||||
$ rails generate devise:controllers [scope]
|
||||
```
|
||||
|
||||
If you specify `users` as the scope, controllers will be created in `app/controllers/users/`.
|
||||
@@ -310,14 +410,15 @@ If the customization at the views level is not enough, you can customize each co
|
||||
...
|
||||
end
|
||||
```
|
||||
Use the `-c` flag to specify one or more controllers, for example: `rails generate devise:controllers users -c sessions`)
|
||||
|
||||
2. Tell the router to use this controller:
|
||||
|
||||
```ruby
|
||||
devise_for :users, controllers: { sessions: "users/sessions" }
|
||||
devise_for :users, controllers: { sessions: 'users/sessions' }
|
||||
```
|
||||
|
||||
3. Copy the views from `devise/sessions` to `users/sessions`. Since the controller was changed, it won't use the default views located in `devise/sessions`.
|
||||
3. Recommended but not required: copy (or move) the views from `devise/sessions` to `users/sessions`. Rails will continue using the views from `devise/sessions` due to inheritance if you skip this step, but having the views matching the controller(s) keeps things consistent.
|
||||
|
||||
4. Finally, change or extend the desired controller actions.
|
||||
|
||||
@@ -331,7 +432,7 @@ If the customization at the views level is not enough, you can customize each co
|
||||
end
|
||||
```
|
||||
|
||||
Or you can simply add new behaviour to it:
|
||||
Or you can simply add new behavior to it:
|
||||
|
||||
```ruby
|
||||
class Users::SessionsController < Devise::SessionsController
|
||||
@@ -352,21 +453,57 @@ Remember that Devise uses flash messages to let users know if sign in was succes
|
||||
Devise also ships with default routes. If you need to customize them, you should probably be able to do it through the devise_for method. It accepts several options like :class_name, :path_prefix and so on, including the possibility to change path names for I18n:
|
||||
|
||||
```ruby
|
||||
devise_for :users, path: "auth", path_names: { sign_in: 'login', sign_out: 'logout', password: 'secret', confirmation: 'verification', unlock: 'unblock', registration: 'register', sign_up: 'cmon_let_me_in' }
|
||||
devise_for :users, path: 'auth', path_names: { sign_in: 'login', sign_out: 'logout', password: 'secret', confirmation: 'verification', unlock: 'unblock', registration: 'register', sign_up: 'cmon_let_me_in' }
|
||||
```
|
||||
|
||||
Be sure to check `devise_for` [documentation](http://www.rubydoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper%3Adevise_for) for details.
|
||||
Be sure to check `devise_for` [documentation](http://www.rubydoc.info/github/heartcombo/devise/main/ActionDispatch/Routing/Mapper%3Adevise_for) for details.
|
||||
|
||||
If you have the need for more deep customization, for instance to also allow "/sign_in" besides "/users/sign_in", all you need to do is create your routes normally and wrap them in a `devise_scope` block in the router:
|
||||
|
||||
```ruby
|
||||
devise_scope :user do
|
||||
get "sign_in", to: "devise/sessions#new"
|
||||
get 'sign_in', to: 'devise/sessions#new'
|
||||
end
|
||||
```
|
||||
|
||||
This way, you tell Devise to use the scope `:user` when "/sign_in" is accessed. Notice `devise_scope` is also aliased as `as` in your router.
|
||||
|
||||
Please note: You will still need to add `devise_for` in your routes in order to use helper methods such as `current_user`.
|
||||
|
||||
```ruby
|
||||
devise_for :users, skip: :all
|
||||
```
|
||||
|
||||
### Hotwire/Turbo
|
||||
|
||||
Devise integrates with Hotwire/Turbo by treating such requests as navigational, and configuring certain responses for errors and redirects to match the expected behavior. New apps are generated with the following response configuration by default, and existing apps may opt-in by adding the config to their Devise initializers:
|
||||
|
||||
```ruby
|
||||
Devise.setup do |config|
|
||||
# ...
|
||||
# When using Devise with Hotwire/Turbo, the http status for error responses
|
||||
# and some redirects must match the following. The default in Devise for existing
|
||||
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
||||
# these new defaults that match Hotwire/Turbo behavior.
|
||||
# Note: These might become the new default in future versions of Devise.
|
||||
config.responder.error_status = :unprocessable_entity
|
||||
config.responder.redirect_status = :see_other
|
||||
end
|
||||
```
|
||||
|
||||
**Important**: these custom responses require the `responders` gem version to be `3.1.0` or higher, please make sure you update it if you're going to use this configuration. Check [this upgrade guide](https://github.com/heartcombo/devise/wiki/How-To:-Upgrade-to-Devise-4.9.0-[Hotwire-Turbo-integration]) for more info.
|
||||
|
||||
_Note_: the above statuses configuration may become the default for Devise in a future release.
|
||||
|
||||
There are a couple other changes you might need to make in your app to work with Hotwire/Turbo, if you're migrating from rails-ujs:
|
||||
|
||||
* The `data-confirm` option that adds a confirmation modal to buttons/forms before submission needs to change to `data-turbo-confirm`, so that Turbo handles those appropriately.
|
||||
* The `data-method` option that sets the request method for link submissions needs to change to `data-turbo-method`. This is not necessary for `button_to` or `form`s since Turbo can handle those.
|
||||
|
||||
If you're setting up Devise to sign out via `:delete`, and you're using links (instead of buttons wrapped in a form) to sign out with the `method: :delete` option, they will need to be updated as described above. (Devise does not provide sign out links/buttons in its shared views.)
|
||||
|
||||
Make sure to inspect your views looking for those, and change appropriately.
|
||||
|
||||
### I18n
|
||||
|
||||
Devise uses flash messages with I18n, in conjunction with the flash keys :notice and :alert. To customize your app, you can set up your locale file:
|
||||
@@ -405,55 +542,113 @@ en:
|
||||
|
||||
Take a look at our locale file to check all available messages. You may also be interested in one of the many translations that are available on our wiki:
|
||||
|
||||
https://github.com/plataformatec/devise/wiki/I18n
|
||||
https://github.com/heartcombo/devise/wiki/I18n
|
||||
|
||||
Caution: Devise Controllers inherit from ApplicationController. If your app uses multiple locales, you should be sure to set I18n.locale in ApplicationController.
|
||||
|
||||
### Test helpers
|
||||
|
||||
Devise includes some test helpers for functional specs. In order to use them, you need to include Devise in your functional tests by adding the following to the bottom of your `test/test_helper.rb` file (make sure you place it out of scope of `ActiveSupport::TestCase` which is the default class inside of `test/test_helper.rb`):
|
||||
Devise includes some test helpers for controller and integration tests.
|
||||
In order to use them, you need to include the respective module in your test
|
||||
cases/specs.
|
||||
|
||||
### Controller tests
|
||||
|
||||
Controller tests require that you include `Devise::Test::IntegrationHelpers` on
|
||||
your test case or its parent `ActionController::TestCase` superclass.
|
||||
For Rails versions prior to 5, include `Devise::Test::ControllerHelpers` instead, since the superclass
|
||||
for controller tests was changed to ActionDispatch::IntegrationTest
|
||||
(for more details, see the [Integration tests](#integration-tests) section).
|
||||
|
||||
```ruby
|
||||
class ActionController::TestCase
|
||||
include Devise::TestHelpers
|
||||
class PostsControllerTest < ActionController::TestCase
|
||||
include Devise::Test::IntegrationHelpers # Rails >= 5
|
||||
end
|
||||
```
|
||||
|
||||
If you're using RSpec, you can put the following inside a file named `spec/support/devise.rb` or in your `spec/spec_helper.rb` (or `spec/rails_helper.rb` if you are using rspec-rails):
|
||||
```ruby
|
||||
class PostsControllerTest < ActionController::TestCase
|
||||
include Devise::Test::ControllerHelpers # Rails < 5
|
||||
end
|
||||
```
|
||||
|
||||
If you're using RSpec, you can put the following inside a file named
|
||||
`spec/support/devise.rb` or in your `spec/spec_helper.rb` (or
|
||||
`spec/rails_helper.rb` if you are using `rspec-rails`):
|
||||
|
||||
```ruby
|
||||
RSpec.configure do |config|
|
||||
config.include Devise::TestHelpers, type: :controller
|
||||
config.include Devise::TestHelpers, type: :view
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include Devise::Test::ControllerHelpers, type: :view
|
||||
end
|
||||
```
|
||||
|
||||
Just be sure that this inclusion is made *after* the `require 'rspec/rails'` directive.
|
||||
|
||||
Now you are ready to use the `sign_in` and `sign_out` methods. Such methods have the same signature as in controllers:
|
||||
Now you are ready to use the `sign_in` and `sign_out` methods on your controller
|
||||
tests:
|
||||
|
||||
```ruby
|
||||
sign_in :user, @user # sign_in(scope, resource)
|
||||
sign_in @user # sign_in(resource)
|
||||
|
||||
sign_out :user # sign_out(scope)
|
||||
sign_out @user # sign_out(resource)
|
||||
sign_in @user
|
||||
sign_in @user, scope: :admin
|
||||
```
|
||||
|
||||
There are two things that are important to keep in mind:
|
||||
If you are testing Devise internal controllers or a controller that inherits
|
||||
from Devise's, you need to tell Devise which mapping should be used before a
|
||||
request. This is necessary because Devise gets this information from the router,
|
||||
but since controller tests do not pass through the router, it needs to be stated
|
||||
explicitly. For example, if you are testing the user scope, simply use:
|
||||
|
||||
1. These helpers are not going to work for integration tests driven by Capybara or Webrat. They are meant to be used with functional tests only. It is undesirable even to include `Devise::TestHelpers` during integration tests. Instead, fill in the form or explicitly set the user in session;
|
||||
```ruby
|
||||
test 'GET new' do
|
||||
# Mimic the router behavior of setting the Devise scope through the env.
|
||||
@request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
|
||||
2. If you are testing Devise internal controllers or a controller that inherits from Devise's, you need to tell Devise which mapping should be used before a request. This is necessary because Devise gets this information from the router, but since functional tests do not pass through the router, it needs to be stated explicitly. For example, if you are testing the user scope, simply use:
|
||||
# Use the sign_in helper to sign in a fixture `User` record.
|
||||
sign_in users(:alice)
|
||||
|
||||
```ruby
|
||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||
get :new
|
||||
```
|
||||
get :new
|
||||
|
||||
# assert something
|
||||
end
|
||||
```
|
||||
|
||||
### Integration tests
|
||||
|
||||
Integration test helpers are available by including the
|
||||
`Devise::Test::IntegrationHelpers` module.
|
||||
|
||||
```ruby
|
||||
class PostsTests < ActionDispatch::IntegrationTest
|
||||
include Devise::Test::IntegrationHelpers
|
||||
end
|
||||
```
|
||||
|
||||
Now you can use the following `sign_in` and `sign_out` methods in your integration
|
||||
tests:
|
||||
|
||||
```ruby
|
||||
sign_in users(:bob)
|
||||
sign_in users(:bob), scope: :admin
|
||||
|
||||
sign_out :user
|
||||
```
|
||||
|
||||
RSpec users can include the `IntegrationHelpers` module on their `:feature` specs.
|
||||
|
||||
```ruby
|
||||
RSpec.configure do |config|
|
||||
config.include Devise::Test::IntegrationHelpers, type: :feature
|
||||
end
|
||||
```
|
||||
|
||||
Unlike controller tests, integration tests do not need to supply the
|
||||
`devise.mapping` `env` value, as the mapping can be inferred by the routes that
|
||||
are executed in your tests.
|
||||
|
||||
You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
|
||||
|
||||
* https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-%28and-RSpec%29
|
||||
* https://github.com/heartcombo/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)
|
||||
|
||||
### OmniAuth
|
||||
|
||||
@@ -465,7 +660,7 @@ config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
|
||||
You can read more about OmniAuth support in the wiki:
|
||||
|
||||
* https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
|
||||
* https://github.com/heartcombo/devise/wiki/OmniAuth:-Overview
|
||||
|
||||
### Configuring multiple models
|
||||
|
||||
@@ -512,12 +707,12 @@ end
|
||||
|
||||
### Password reset tokens and Rails logs
|
||||
|
||||
If you enable the [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable) module, note that a stolen password reset token could give an attacker access to your application. Devise takes effort to generate random, secure tokens, and stores only token digests in the database, never plaintext. However the default logging behavior in Rails can cause plaintext tokens to leak into log files:
|
||||
If you enable the [Recoverable](http://rubydoc.info/github/heartcombo/devise/main/Devise/Models/Recoverable) module, note that a stolen password reset token could give an attacker access to your application. Devise takes effort to generate random, secure tokens, and stores only token digests in the database, never plaintext. However the default logging behavior in Rails can cause plaintext tokens to leak into log files:
|
||||
|
||||
1. Action Mailer logs the entire contents of all outgoing emails to the DEBUG level. Password reset tokens delivered to users in email will be leaked.
|
||||
2. Active Job logs all arguments to every enqueued job at the INFO level. If you configure Devise to use `deliver_later` to send password reset emails, password reset tokens will be leaked.
|
||||
|
||||
Rails sets the production logger level to DEBUG by default. Consider changing your production logger level to WARN if you wish to prevent tokens from being leaked into your logs. In `config/environments/production.rb`:
|
||||
Rails sets the production logger level to INFO by default. Consider changing your production logger level to WARN if you wish to prevent tokens from being leaked into your logs. In `config/environments/production.rb`:
|
||||
|
||||
```ruby
|
||||
config.log_level = :warn
|
||||
@@ -528,32 +723,50 @@ config.log_level = :warn
|
||||
|
||||
Devise supports ActiveRecord (default) and Mongoid. To select another ORM, simply require it in the initializer file.
|
||||
|
||||
## Additional information
|
||||
### Rails API Mode
|
||||
|
||||
### Heroku
|
||||
Rails 5+ has a built-in [API Mode](https://edgeguides.rubyonrails.org/api_app.html) which optimizes Rails for use as an API (only). Devise is _somewhat_ able to handle applications that are built in this mode without additional modifications in the sense that it should not raise exceptions and the like. But some issues may still arise during `development`/`testing`, as we still don't know the full extent of this compatibility. (For more information, see [issue #4947](https://github.com/heartcombo/devise/issues/4947/))
|
||||
|
||||
Using Devise on Heroku with Ruby on Rails 3.2 requires setting:
|
||||
#### Supported Authentication Strategies
|
||||
API-only applications don't support browser-based authentication via cookies, which is devise's default. Yet, devise can still provide authentication out of the box in those cases with the `http_authenticatable` strategy, which uses HTTP Basic Auth and authenticates the user on each request. (For more info, see this wiki article for [How To: Use HTTP Basic Authentication](https://github.com/heartcombo/devise/wiki/How-To:-Use-HTTP-Basic-Authentication))
|
||||
|
||||
The devise default for HTTP Auth is disabled, so it will need to be enabled in the devise initializer for the database strategy:
|
||||
|
||||
```ruby
|
||||
config.assets.initialize_on_precompile = false
|
||||
config.http_authenticatable = [:database]
|
||||
```
|
||||
|
||||
Read more about the potential issues at http://guides.rubyonrails.org/asset_pipeline.html
|
||||
This restriction does not limit you from implementing custom warden strategies, either in your application or via gem-based extensions for devise.
|
||||
A common authentication strategy for APIs is token-based authentication. For more information on extending devise to support this type of authentication and others, see the wiki article for [Simple Token Authentication Examples and alternatives](https://github.com/heartcombo/devise/wiki/How-To:-Simple-Token-Authentication-Example#alternatives) or this blog post on [Custom authentication methods with Devise](http://blog.plataformatec.com.br/2019/01/custom-authentication-methods-with-devise/).
|
||||
|
||||
#### Testing
|
||||
API Mode changes the order of the middleware stack, and this can cause problems for `Devise::Test::IntegrationHelpers`. This problem usually surfaces as an ```undefined method `[]=' for nil:NilClass``` error when using integration test helpers, such as `#sign_in`. The solution is simply to reorder the middlewares by adding the following to test.rb:
|
||||
|
||||
```ruby
|
||||
Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Cookies
|
||||
Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Session::CookieStore
|
||||
```
|
||||
|
||||
For a deeper understanding of this, review [this issue](https://github.com/heartcombo/devise/issues/4696).
|
||||
|
||||
Additionally be mindful that without views supported, some email-based flows from Confirmable, Recoverable and Lockable are not supported directly at this time.
|
||||
|
||||
## Additional information
|
||||
|
||||
### Warden
|
||||
|
||||
Devise is based on Warden, which is a general Rack authentication framework created by Daniel Neighman. We encourage you to read more about Warden here:
|
||||
|
||||
https://github.com/hassox/warden
|
||||
https://github.com/wardencommunity/warden
|
||||
|
||||
### Contributors
|
||||
|
||||
We have a long list of valued contributors. Check them all at:
|
||||
|
||||
https://github.com/plataformatec/devise/graphs/contributors
|
||||
https://github.com/heartcombo/devise/graphs/contributors
|
||||
|
||||
## License
|
||||
|
||||
MIT License. Copyright 2009-2016 Plataformatec. http://plataformatec.com.br
|
||||
MIT License. Copyright 2020-2024 Rafael França, Leonardo Tegon, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
|
||||
|
||||
You are not granted rights or licenses to the trademarks of Plataformatec, including without limitation the Devise name or logo.
|
||||
The Devise logo is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
|
||||
|
||||
1
Rakefile
1
Rakefile
@@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/gem_tasks'
|
||||
require 'rake/testtask'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Devise::ConfirmationsController < DeviseController
|
||||
# GET /resource/confirmation/new
|
||||
def new
|
||||
@@ -25,6 +27,7 @@ class Devise::ConfirmationsController < DeviseController
|
||||
set_flash_message!(:notice, :confirmed)
|
||||
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
|
||||
else
|
||||
# TODO: use `error_status` when the default changes to `:unprocessable_entity`.
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Devise::OmniauthCallbacksController < DeviseController
|
||||
prepend_before_action { request.env["devise.skip_timeout"] = true }
|
||||
|
||||
def passthru
|
||||
render status: 404, text: "Not found. Authentication passthru."
|
||||
render status: 404, plain: "Not found. Authentication passthru."
|
||||
end
|
||||
|
||||
def failure
|
||||
set_flash_message :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
|
||||
set_flash_message! :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
|
||||
redirect_to after_omniauth_failure_path_for(resource_name)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def failed_strategy
|
||||
request.respond_to?(:get_header) ? request.get_header("omniauth.error.strategy") : env["omniauth.error.strategy"]
|
||||
request.respond_to?(:get_header) ? request.get_header("omniauth.error.strategy") : request.env["omniauth.error.strategy"]
|
||||
end
|
||||
|
||||
def failure_message
|
||||
exception = request.respond_to?(:get_header) ? request.get_header("omniauth.error") : env["omniauth.error"]
|
||||
exception = request.respond_to?(:get_header) ? request.get_header("omniauth.error") : request.env["omniauth.error"]
|
||||
error = exception.error_reason if exception.respond_to?(:error_reason)
|
||||
error ||= exception.error if exception.respond_to?(:error)
|
||||
error ||= (request.respond_to?(:get_header) ? request.get_header("omniauth.error.type") : env["omniauth.error.type"]).to_s
|
||||
error ||= (request.respond_to?(:get_header) ? request.get_header("omniauth.error.type") : request.env["omniauth.error.type"]).to_s
|
||||
error.to_s.humanize if error
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Devise::PasswordsController < DeviseController
|
||||
prepend_before_action :require_no_authentication
|
||||
# Render the #edit only if coming from a reset password email link
|
||||
@@ -34,9 +36,10 @@ class Devise::PasswordsController < DeviseController
|
||||
|
||||
if resource.errors.empty?
|
||||
resource.unlock_access! if unlockable?(resource)
|
||||
if Devise.sign_in_after_reset_password
|
||||
if resource_class.sign_in_after_reset_password
|
||||
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
|
||||
set_flash_message!(:notice, flash_message)
|
||||
resource.after_database_authentication
|
||||
sign_in(resource_name, resource)
|
||||
else
|
||||
set_flash_message!(:notice, :updated_not_active)
|
||||
@@ -50,7 +53,7 @@ class Devise::PasswordsController < DeviseController
|
||||
|
||||
protected
|
||||
def after_resetting_password_path_for(resource)
|
||||
Devise.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
|
||||
resource_class.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
|
||||
end
|
||||
|
||||
# The path used after sending reset password instructions
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Devise::RegistrationsController < DeviseController
|
||||
prepend_before_action :require_no_authentication, only: [:new, :create, :cancel]
|
||||
prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy]
|
||||
prepend_before_action :set_minimum_password_length, only: [:new, :edit]
|
||||
|
||||
# GET /resource/sign_up
|
||||
def new
|
||||
build_resource({})
|
||||
set_minimum_password_length
|
||||
build_resource
|
||||
yield resource if block_given?
|
||||
respond_with self.resource
|
||||
respond_with resource
|
||||
end
|
||||
|
||||
# POST /resource
|
||||
@@ -48,15 +50,13 @@ class Devise::RegistrationsController < DeviseController
|
||||
resource_updated = update_resource(resource, account_update_params)
|
||||
yield resource if block_given?
|
||||
if resource_updated
|
||||
if is_flashing_format?
|
||||
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
|
||||
:update_needs_confirmation : :updated
|
||||
set_flash_message :notice, flash_key
|
||||
end
|
||||
sign_in resource_name, resource, bypass: true
|
||||
set_flash_message_for_update(resource, prev_unconfirmed_email)
|
||||
bypass_sign_in resource, scope: resource_name if sign_in_after_change_password?
|
||||
|
||||
respond_with resource, location: after_update_path_for(resource)
|
||||
else
|
||||
clean_up_passwords resource
|
||||
set_minimum_password_length
|
||||
respond_with resource
|
||||
end
|
||||
end
|
||||
@@ -67,7 +67,7 @@ class Devise::RegistrationsController < DeviseController
|
||||
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
|
||||
set_flash_message! :notice, :destroyed
|
||||
yield resource if block_given?
|
||||
respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) }
|
||||
respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name), status: Devise.responder.redirect_status }
|
||||
end
|
||||
|
||||
# GET /resource/cancel
|
||||
@@ -96,8 +96,8 @@ class Devise::RegistrationsController < DeviseController
|
||||
|
||||
# Build a devise resource passing in the session. Useful to move
|
||||
# temporary session data to the newly created user.
|
||||
def build_resource(hash=nil)
|
||||
self.resource = resource_class.new_with_session(hash || {}, session)
|
||||
def build_resource(hash = {})
|
||||
self.resource = resource_class.new_with_session(hash, session)
|
||||
end
|
||||
|
||||
# Signs in a user on sign up. You can overwrite this method in your own
|
||||
@@ -109,7 +109,7 @@ class Devise::RegistrationsController < DeviseController
|
||||
# The path used after sign up. You need to overwrite this method
|
||||
# in your own RegistrationsController.
|
||||
def after_sign_up_path_for(resource)
|
||||
after_sign_in_path_for(resource)
|
||||
after_sign_in_path_for(resource) if is_navigational_format?
|
||||
end
|
||||
|
||||
# The path used after sign up for inactive accounts. You need to overwrite
|
||||
@@ -124,7 +124,7 @@ class Devise::RegistrationsController < DeviseController
|
||||
# The default url to be used after updating a resource. You need to overwrite
|
||||
# this method in your own RegistrationsController.
|
||||
def after_update_path_for(resource)
|
||||
signed_in_root_path(resource)
|
||||
sign_in_after_change_password? ? signed_in_root_path(resource) : new_session_path(resource_name)
|
||||
end
|
||||
|
||||
# Authenticates the current scope and gets the current resource from the session.
|
||||
@@ -144,4 +144,25 @@ class Devise::RegistrationsController < DeviseController
|
||||
def translation_scope
|
||||
'devise.registrations'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_flash_message_for_update(resource, prev_unconfirmed_email)
|
||||
return unless is_flashing_format?
|
||||
|
||||
flash_key = if update_needs_confirmation?(resource, prev_unconfirmed_email)
|
||||
:update_needs_confirmation
|
||||
elsif sign_in_after_change_password?
|
||||
:updated
|
||||
else
|
||||
:updated_but_not_signed_in
|
||||
end
|
||||
set_flash_message :notice, flash_key
|
||||
end
|
||||
|
||||
def sign_in_after_change_password?
|
||||
return true if account_update_params[:password].blank?
|
||||
|
||||
Devise.sign_in_after_change_password
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Devise::SessionsController < DeviseController
|
||||
prepend_before_action :require_no_authentication, only: [:new, :create]
|
||||
prepend_before_action :allow_params_authentication!, only: :create
|
||||
prepend_before_action :verify_signed_out_user, only: :destroy
|
||||
prepend_before_action only: [:create, :destroy] { request.env["devise.skip_timeout"] = true }
|
||||
prepend_before_action(only: [:create, :destroy]) { request.env["devise.skip_timeout"] = true }
|
||||
|
||||
# GET /resource/sign_in
|
||||
def new
|
||||
@@ -43,7 +45,7 @@ class Devise::SessionsController < DeviseController
|
||||
end
|
||||
|
||||
def auth_options
|
||||
{ scope: resource_name, recall: "#{controller_path}#new" }
|
||||
{ scope: resource_name, recall: "#{controller_path}#new", locale: I18n.locale }
|
||||
end
|
||||
|
||||
def translation_scope
|
||||
@@ -75,7 +77,7 @@ class Devise::SessionsController < DeviseController
|
||||
# support returning empty response on GET request
|
||||
respond_to do |format|
|
||||
format.all { head :no_content }
|
||||
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name) }
|
||||
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name), status: Devise.responder.redirect_status }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Devise::UnlocksController < DeviseController
|
||||
prepend_before_action :require_no_authentication
|
||||
|
||||
@@ -27,6 +29,7 @@ class Devise::UnlocksController < DeviseController
|
||||
set_flash_message! :notice, :unlocked
|
||||
respond_with_navigational(resource){ redirect_to after_unlock_path_for(resource) }
|
||||
else
|
||||
# TODO: use `error_status` when the default changes to `:unprocessable_entity`.
|
||||
respond_with_navigational(resource.errors, status: :unprocessable_entity){ render :new }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# All Devise controllers are inherited from here.
|
||||
class DeviseController < Devise.parent_controller.constantize
|
||||
include Devise::Controllers::ScopedViews
|
||||
@@ -13,6 +15,7 @@ class DeviseController < Devise.parent_controller.constantize
|
||||
end
|
||||
|
||||
prepend_before_action :assert_is_devise_resource!
|
||||
self.responder = Devise.responder
|
||||
respond_to :html if mimes_for_respond_to.empty?
|
||||
|
||||
# Override prefixes to consider the scoped view.
|
||||
@@ -20,7 +23,7 @@ class DeviseController < Devise.parent_controller.constantize
|
||||
# Action Controller tests that forces _prefixes to be
|
||||
# loaded before even having a request object.
|
||||
#
|
||||
# This method should be public as it is is in ActionPack
|
||||
# This method should be public as it is in ActionPack
|
||||
# itself. Changing its visibility may break other gems.
|
||||
def _prefixes #:nodoc:
|
||||
@_prefixes ||= if self.class.scoped_views? && request && devise_mapping
|
||||
@@ -30,6 +33,19 @@ class DeviseController < Devise.parent_controller.constantize
|
||||
end
|
||||
end
|
||||
|
||||
# Override internal methods to exclude `_prefixes` from action methods since
|
||||
# we override it above.
|
||||
#
|
||||
# There was an intentional change in Rails 7.1 that will allow it to become
|
||||
# an action method because it's a public method of a non-abstract controller,
|
||||
# but we also can't make this abstract because it can affect potential actions
|
||||
# defined in the parent controller, so instead we ensure `_prefixes` is going
|
||||
# to be considered internal. (and thus, won't become an action method.)
|
||||
# Ref: https://github.com/rails/rails/pull/48699
|
||||
def self.internal_methods #:nodoc:
|
||||
super << :_prefixes
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# Gets the actual resource stored in the instance variable
|
||||
@@ -110,7 +126,7 @@ MESSAGE
|
||||
end
|
||||
|
||||
if authenticated && resource = warden.user(resource_name)
|
||||
flash[:alert] = I18n.t("devise.failure.already_authenticated")
|
||||
set_flash_message(:alert, 'already_authenticated', scope: 'devise.failure')
|
||||
redirect_to after_sign_in_path_for(resource)
|
||||
end
|
||||
end
|
||||
@@ -182,7 +198,7 @@ MESSAGE
|
||||
options[:default] = Array(options[:default]).unshift(kind.to_sym)
|
||||
options[:resource_name] = resource_name
|
||||
options = devise_i18n_options(options)
|
||||
I18n.t("#{options[:resource_name]}.#{kind}", options)
|
||||
I18n.t("#{options[:resource_name]}.#{kind}", **options)
|
||||
end
|
||||
|
||||
# Controllers inheriting DeviseController are advised to override this
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module DeviseHelper
|
||||
# A simple way to show error messages for the current devise resource. If you need
|
||||
# to customize this method, you can either overwrite it in your application helpers or
|
||||
# copy the views to your application.
|
||||
#
|
||||
# This method is intended to stay simple and it is unlikely that we are going to change
|
||||
# it to add more behavior or options.
|
||||
# Retain this method for backwards compatibility, deprecated in favor of modifying the
|
||||
# devise/shared/error_messages partial.
|
||||
def devise_error_messages!
|
||||
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] `DeviseHelper#devise_error_messages!` is deprecated and will be
|
||||
removed in the next major version.
|
||||
|
||||
Devise now uses a partial under "devise/shared/error_messages" to display
|
||||
error messages by default, and make them easier to customize. Update your
|
||||
views changing calls from:
|
||||
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
to:
|
||||
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
To start customizing how errors are displayed, you can copy the partial
|
||||
from devise to your `app/views` folder. Alternatively, you can run
|
||||
`rails g devise:views` which will copy all of them again to your app.
|
||||
DEPRECATION
|
||||
|
||||
return "" if resource.errors.empty?
|
||||
|
||||
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
|
||||
sentence = I18n.t("errors.messages.not_saved",
|
||||
count: resource.errors.count,
|
||||
resource: resource.class.model_name.human.downcase)
|
||||
|
||||
html = <<-HTML
|
||||
<div id="error_explanation">
|
||||
<h2>#{sentence}</h2>
|
||||
<ul>#{messages}</ul>
|
||||
</div>
|
||||
HTML
|
||||
|
||||
html.html_safe
|
||||
render "devise/shared/error_messages", resource: resource
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
if defined?(ActionMailer)
|
||||
class Devise::Mailer < Devise.parent_mailer.constantize
|
||||
include Devise::Mailers::Helpers
|
||||
|
||||
def confirmation_instructions(record, token, opts={})
|
||||
def confirmation_instructions(record, token, opts = {})
|
||||
@token = token
|
||||
devise_mail(record, :confirmation_instructions, opts)
|
||||
end
|
||||
|
||||
def reset_password_instructions(record, token, opts={})
|
||||
def reset_password_instructions(record, token, opts = {})
|
||||
@token = token
|
||||
devise_mail(record, :reset_password_instructions, opts)
|
||||
end
|
||||
|
||||
def unlock_instructions(record, token, opts={})
|
||||
def unlock_instructions(record, token, opts = {})
|
||||
@token = token
|
||||
devise_mail(record, :unlock_instructions, opts)
|
||||
end
|
||||
|
||||
def password_change(record, opts={})
|
||||
def email_changed(record, opts = {})
|
||||
devise_mail(record, :email_changed, opts)
|
||||
end
|
||||
|
||||
def password_change(record, opts = {})
|
||||
devise_mail(record, :password_change, opts)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
7
app/views/devise/mailer/email_changed.html.erb
Normal file
7
app/views/devise/mailer/email_changed.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<p>Hello <%= @email %>!</p>
|
||||
|
||||
<% if @resource.try(:unconfirmed_email?) %>
|
||||
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
||||
<% else %>
|
||||
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
|
||||
<% end %>
|
||||
@@ -1,7 +1,7 @@
|
||||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<div class="field">
|
||||
@@ -9,12 +9,12 @@
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
||||
<% end %>
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<h2>Forgot your password?</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
@@ -14,17 +14,21 @@
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
<%= f.password_field :password, autocomplete: "new-password" %>
|
||||
<% if @minimum_password_length %>
|
||||
<br />
|
||||
<em><%= @minimum_password_length %> characters minimum</em>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password, autocomplete: "off" %>
|
||||
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@@ -34,6 +38,6 @@
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
<div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
@@ -13,12 +13,12 @@
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
<%= f.password_field :password, autocomplete: "new-password" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
<%= f.password_field :password, autocomplete: "current-password" %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<% if devise_mapping.rememberable? %>
|
||||
<div class="field">
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me %>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Log in" %>
|
||||
|
||||
15
app/views/devise/shared/_error_messages.html.erb
Normal file
15
app/views/devise/shared/_error_messages.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<% if resource.errors.any? %>
|
||||
<div id="error_explanation" data-turbo-cache="false">
|
||||
<h2>
|
||||
<%= I18n.t("errors.messages.not_saved",
|
||||
count: resource.errors.count,
|
||||
resource: resource.class.model_name.human.downcase)
|
||||
%>
|
||||
</h2>
|
||||
<ul>
|
||||
<% resource.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,25 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<h2>Resend unlock instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
16
bin/test
16
bin/test
@@ -1,13 +1,17 @@
|
||||
#!/usr/bin/env ruby
|
||||
$: << File.expand_path(File.expand_path('../../test', __FILE__))
|
||||
|
||||
require 'bundler/setup'
|
||||
# Remove this begin/rescue once Rails 4 support is removed.
|
||||
begin
|
||||
require 'rails/test_unit/minitest_plugin'
|
||||
require 'bundler/setup'
|
||||
require 'rails/test_unit/runner'
|
||||
require 'rails/test_unit/reporter'
|
||||
require 'rails/test_unit/line_filtering'
|
||||
|
||||
Rails::TestUnitReporter.executable = 'bin/test'
|
||||
|
||||
Rails::TestUnit::Runner.parse_options(ARGV)
|
||||
Rails::TestUnit::Runner.run(ARGV)
|
||||
rescue LoadError
|
||||
exec 'rake'
|
||||
end
|
||||
|
||||
Rails::TestUnitReporter.executable = 'bin/test'
|
||||
|
||||
exit Minitest.run(ARGV)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
||||
# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
|
||||
|
||||
en:
|
||||
devise:
|
||||
@@ -23,6 +23,8 @@ en:
|
||||
subject: "Reset password instructions"
|
||||
unlock_instructions:
|
||||
subject: "Unlock instructions"
|
||||
email_changed:
|
||||
subject: "Email Changed"
|
||||
password_change:
|
||||
subject: "Password Changed"
|
||||
omniauth_callbacks:
|
||||
@@ -40,8 +42,9 @@ en:
|
||||
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
|
||||
updated: "Your account has been updated successfully."
|
||||
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
|
||||
sessions:
|
||||
signed_in: "Signed in successfully."
|
||||
signed_out: "Signed out successfully."
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# frozen_string_literal: true
|
||||
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
require "devise/version"
|
||||
|
||||
@@ -8,19 +10,33 @@ Gem::Specification.new do |s|
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.licenses = ["MIT"]
|
||||
s.summary = "Flexible authentication solution for Rails with Warden"
|
||||
s.email = "contact@plataformatec.com.br"
|
||||
s.homepage = "https://github.com/plataformatec/devise"
|
||||
s.email = "heartcombo@googlegroups.com"
|
||||
s.homepage = "https://github.com/heartcombo/devise"
|
||||
s.description = "Flexible authentication solution for Rails with Warden"
|
||||
s.authors = ['José Valim', 'Carlos Antônio']
|
||||
s.metadata = {
|
||||
"homepage_uri" => "https://github.com/heartcombo/devise",
|
||||
"documentation_uri" => "https://rubydoc.info/github/heartcombo/devise",
|
||||
"changelog_uri" => "https://github.com/heartcombo/devise/blob/main/CHANGELOG.md",
|
||||
"source_code_uri" => "https://github.com/heartcombo/devise",
|
||||
"bug_tracker_uri" => "https://github.com/heartcombo/devise/issues",
|
||||
"wiki_uri" => "https://github.com/heartcombo/devise/wiki"
|
||||
}
|
||||
|
||||
s.files = `git ls-files`.split("\n")
|
||||
s.test_files = `git ls-files -- test/*`.split("\n")
|
||||
s.files = Dir["{app,config,lib}/**/*", "CHANGELOG.md", "MIT-LICENSE", "README.md"]
|
||||
s.require_paths = ["lib"]
|
||||
s.required_ruby_version = '>= 2.1.0'
|
||||
|
||||
s.add_dependency("warden", "~> 1.2.3")
|
||||
s.add_dependency("orm_adapter", "~> 0.1")
|
||||
s.add_dependency("bcrypt", "~> 3.0")
|
||||
s.add_dependency("railties", ">= 4.1.0", "< 5.1")
|
||||
s.add_dependency("railties", ">= 4.1.0")
|
||||
s.add_dependency("responders")
|
||||
|
||||
s.post_install_message = %q{
|
||||
[DEVISE] Please review the [changelog] and [upgrade guide] for more info on Hotwire / Turbo integration.
|
||||
|
||||
[changelog] https://github.com/heartcombo/devise/blob/main/CHANGELOG.md
|
||||
[upgrade guide] https://github.com/heartcombo/devise/wiki/How-To:-Upgrade-to-Devise-4.9.0-%5BHotwire-Turbo-integration%5D
|
||||
}
|
||||
end
|
||||
|
||||
49
gemfiles/Gemfile-rails-4-1
Normal file
49
gemfiles/Gemfile-rails-4-1
Normal file
@@ -0,0 +1,49 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
git_source(:github) do |repo_name|
|
||||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
||||
"https://github.com/#{repo_name}.git"
|
||||
end
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "4-1-stable"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc", "~> 5.1"
|
||||
# Force this version because it's breaking on CI since a higher nokogiri version requires Ruby 2.3+.
|
||||
gem "nokogiri", "1.9.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem 'test_after_commit', require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0"
|
||||
end
|
||||
|
||||
if RUBY_VERSION < "2.3.0"
|
||||
# We're getting version 2.2.0 which doesn't play nice with Ruby 2.2, using
|
||||
# `Object.deprecate_constant` which isn't available.
|
||||
gem "multipart-post", "2.1.1"
|
||||
end
|
||||
|
||||
# There's a build incompatibility issue with nokogiri and loofah
|
||||
gem "loofah", "~> 2.20.0"
|
||||
48
gemfiles/Gemfile-rails-4-2
Normal file
48
gemfiles/Gemfile-rails-4-2
Normal file
@@ -0,0 +1,48 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
git_source(:github) do |repo_name|
|
||||
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
||||
"https://github.com/#{repo_name}.git"
|
||||
end
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "4-2-stable"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc", "~> 5.1"
|
||||
gem "nokogiri", "1.9.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
gem 'test_after_commit', require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0"
|
||||
end
|
||||
|
||||
if RUBY_VERSION < "2.3.0"
|
||||
# We're getting version 2.2.0 which doesn't play nice with Ruby 2.2, using
|
||||
# `Object.deprecate_constant` which isn't available.
|
||||
gem "multipart-post", "2.1.1"
|
||||
end
|
||||
|
||||
# There's a build incompatibility issue with nokogiri and loofah
|
||||
gem "loofah", "~> 2.20.0"
|
||||
40
gemfiles/Gemfile-rails-5-0
Normal file
40
gemfiles/Gemfile-rails-5-0
Normal file
@@ -0,0 +1,40 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 5.0.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
# TODO:
|
||||
# group :mongoid do
|
||||
# gem "mongoid", "~> 4.0.0"
|
||||
# end
|
||||
|
||||
if RUBY_VERSION < "2.3.0"
|
||||
# We're getting version 2.2.0 which doesn't play nice with Ruby 2.2, using
|
||||
# `Object.deprecate_constant` which isn't available.
|
||||
gem "multipart-post", "2.1.1"
|
||||
end
|
||||
|
||||
# There's a build incompatibility issue with nokogiri and loofah
|
||||
gem "loofah", "~> 2.20.0"
|
||||
33
gemfiles/Gemfile-rails-5-1
Normal file
33
gemfiles/Gemfile-rails-5-1
Normal file
@@ -0,0 +1,33 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 5.1.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
if RUBY_VERSION < "2.3.0"
|
||||
# We're getting version 2.2.0 which doesn't play nice with Ruby 2.2, using
|
||||
# `Object.deprecate_constant` which isn't available.
|
||||
gem "multipart-post", "2.1.1"
|
||||
end
|
||||
|
||||
# There's a build incompatibility issue with nokogiri and loofah
|
||||
gem "loofah", "~> 2.20.0"
|
||||
27
gemfiles/Gemfile-rails-5-2
Normal file
27
gemfiles/Gemfile-rails-5-2
Normal file
@@ -0,0 +1,27 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 5.2.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
end
|
||||
|
||||
# There's a build incompatibility issue with nokogiri and loofah
|
||||
gem "loofah", "~> 2.20.0"
|
||||
25
gemfiles/Gemfile-rails-6-0
Normal file
25
gemfiles/Gemfile-rails-6-0
Normal file
@@ -0,0 +1,25 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 6.0.0', github: 'rails/rails', branch: '6-0-stable'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
31
gemfiles/Gemfile-rails-6-1
Normal file
31
gemfiles/Gemfile-rails-6-1
Normal file
@@ -0,0 +1,31 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", '~> 6.1.0'
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
if RUBY_VERSION >= "3.1"
|
||||
gem "net-smtp", require: false
|
||||
gem "net-imap", require: false
|
||||
gem "net-pop", require: false
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
38
gemfiles/Gemfile-rails-7-0
Normal file
38
gemfiles/Gemfile-rails-7-0
Normal file
@@ -0,0 +1,38 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", "~> 7.0.0"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
|
||||
# platforms :jruby do
|
||||
# gem "activerecord-jdbc-adapter"
|
||||
# gem "activerecord-jdbcsqlite3-adapter"
|
||||
# gem "jruby-openssl"
|
||||
# end
|
||||
|
||||
# TODO:
|
||||
# group :mongoid do
|
||||
# gem "mongoid", "~> 4.0.0"
|
||||
# end
|
||||
25
gemfiles/Gemfile-rails-main
Normal file
25
gemfiles/Gemfile-rails-main
Normal file
@@ -0,0 +1,25 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "main"
|
||||
gem "omniauth"
|
||||
gem "omniauth-oauth2"
|
||||
gem "rdoc"
|
||||
|
||||
gem "rails-controller-testing", github: "rails/rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 3.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid"
|
||||
gem "rexml"
|
||||
gem "timecop"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 2.1", require: false
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3", "~> 1.4"
|
||||
end
|
||||
@@ -1,29 +0,0 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "4-1-stable"
|
||||
gem "omniauth", "~> 1.3"
|
||||
gem "omniauth-oauth2", "~> 1.4"
|
||||
gem "rdoc"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid", "~> 1.0.1"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0.0"
|
||||
end
|
||||
@@ -1,167 +0,0 @@
|
||||
GIT
|
||||
remote: git://github.com/rails/rails.git
|
||||
revision: 41b4d81b4fd14cbf43060c223bea0f461256d099
|
||||
branch: 4-1-stable
|
||||
specs:
|
||||
actionmailer (4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
actionpack (4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
activemodel (4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.15)
|
||||
activemodel (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.15)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 1.1)
|
||||
rails (4.1.15)
|
||||
actionmailer (= 4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
actionview (= 4.1.15)
|
||||
activemodel (= 4.1.15)
|
||||
activerecord (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.15)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (4.1.15)
|
||||
actionpack (= 4.1.15)
|
||||
activesupport (= 4.1.15)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.0.0.rc2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0, < 5.1)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
arel (5.0.1.20140414130214)
|
||||
bcrypt (3.1.11)
|
||||
bson (3.2.6)
|
||||
builder (3.2.2)
|
||||
concurrent-ruby (1.0.1)
|
||||
connection_pool (2.2.0)
|
||||
erubis (2.7.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
hashie (3.4.3)
|
||||
i18n (0.7.0)
|
||||
json (1.8.3)
|
||||
jwt (1.5.1)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
metaclass (0.0.4)
|
||||
mime-types (2.99.1)
|
||||
mini_portile2 (2.0.0)
|
||||
minitest (5.8.4)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mongoid (4.0.2)
|
||||
activemodel (~> 4.0)
|
||||
moped (~> 2.0.0)
|
||||
origin (~> 2.1)
|
||||
tzinfo (>= 0.3.37)
|
||||
moped (2.0.7)
|
||||
bson (~> 3.0)
|
||||
connection_pool (~> 2.0)
|
||||
optionable (~> 0.2.0)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
oauth2 (1.1.0)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 1.0, < 1.5.2)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.3.1)
|
||||
hashie (>= 1.2, < 4)
|
||||
rack (>= 1.0, < 3)
|
||||
omniauth-facebook (3.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.4.0)
|
||||
oauth2 (~> 1.0)
|
||||
omniauth (~> 1.2)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
optionable (0.2.0)
|
||||
origin (2.2.0)
|
||||
orm_adapter (0.5.0)
|
||||
rack (1.5.5)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rake (11.0.1)
|
||||
rdoc (4.2.2)
|
||||
json (~> 1.4)
|
||||
responders (1.1.2)
|
||||
railties (>= 3.2, < 4.2)
|
||||
ruby-openid (2.7.0)
|
||||
sprockets (3.5.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (2.3.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sqlite3 (1.3.11)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.6)
|
||||
rack (>= 1.0)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-jdbc-adapter
|
||||
activerecord-jdbcsqlite3-adapter
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
mongoid (~> 4.0.0)
|
||||
omniauth (~> 1.3)
|
||||
omniauth-facebook
|
||||
omniauth-oauth2 (~> 1.4)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
rails!
|
||||
rdoc
|
||||
sqlite3
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.11.2
|
||||
@@ -1,29 +0,0 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", github: "rails/rails", branch: "4-2-stable"
|
||||
gem "omniauth", "~> 1.3"
|
||||
gem "omniauth-oauth2", "~> 1.4"
|
||||
gem "rdoc"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid", "~> 1.0.1"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
group :mongoid do
|
||||
gem "mongoid", "~> 4.0.0"
|
||||
end
|
||||
@@ -1,189 +0,0 @@
|
||||
GIT
|
||||
remote: git://github.com/rails/rails.git
|
||||
revision: 2aa27582c202148296bb169159b0bf9a47a7bd80
|
||||
branch: 4-2-stable
|
||||
specs:
|
||||
actionmailer (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
activejob (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.6)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
rails (4.2.6)
|
||||
actionmailer (= 4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
actionview (= 4.2.6)
|
||||
activejob (= 4.2.6)
|
||||
activemodel (= 4.2.6)
|
||||
activerecord (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.6)
|
||||
sprockets-rails
|
||||
railties (4.2.6)
|
||||
actionpack (= 4.2.6)
|
||||
activesupport (= 4.2.6)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.0.0.rc2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0, < 5.1)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
arel (6.0.3)
|
||||
bcrypt (3.1.11)
|
||||
bson (3.2.6)
|
||||
builder (3.2.2)
|
||||
concurrent-ruby (1.0.1)
|
||||
connection_pool (2.2.0)
|
||||
erubis (2.7.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
hashie (3.4.3)
|
||||
i18n (0.7.0)
|
||||
json (1.8.3)
|
||||
jwt (1.5.1)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
metaclass (0.0.4)
|
||||
mime-types (2.99.1)
|
||||
mini_portile2 (2.0.0)
|
||||
minitest (5.8.4)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mongoid (4.0.2)
|
||||
activemodel (~> 4.0)
|
||||
moped (~> 2.0.0)
|
||||
origin (~> 2.1)
|
||||
tzinfo (>= 0.3.37)
|
||||
moped (2.0.7)
|
||||
bson (~> 3.0)
|
||||
connection_pool (~> 2.0)
|
||||
optionable (~> 0.2.0)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
oauth2 (1.1.0)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 1.0, < 1.5.2)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.3.1)
|
||||
hashie (>= 1.2, < 4)
|
||||
rack (>= 1.0, < 3)
|
||||
omniauth-facebook (3.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.4.0)
|
||||
oauth2 (~> 1.0)
|
||||
omniauth (~> 1.2)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
optionable (0.2.0)
|
||||
origin (2.2.0)
|
||||
orm_adapter (0.5.0)
|
||||
rack (1.6.4)
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
rake (11.0.1)
|
||||
rdoc (4.2.2)
|
||||
json (~> 1.4)
|
||||
responders (2.1.1)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
ruby-openid (2.7.0)
|
||||
sprockets (3.5.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.0.4)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.11)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.6)
|
||||
rack (>= 1.0)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-jdbc-adapter
|
||||
activerecord-jdbcsqlite3-adapter
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
mongoid (~> 4.0.0)
|
||||
omniauth (~> 1.3)
|
||||
omniauth-facebook
|
||||
omniauth-oauth2 (~> 1.4)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
rails!
|
||||
rdoc
|
||||
sqlite3
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.11.2
|
||||
@@ -1,37 +0,0 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec path: ".."
|
||||
|
||||
gem "rails", "5.0.0.beta3"
|
||||
gem "omniauth", " ~>1.3"
|
||||
gem "oauth2"
|
||||
gem "omniauth-oauth2", ">= 1.2.0", "< 1.5.0"
|
||||
gem "rdoc"
|
||||
|
||||
gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml"
|
||||
|
||||
gem "rails-controller-testing"
|
||||
|
||||
gem "responders", "~> 2.1.1"
|
||||
|
||||
group :test do
|
||||
gem "omniauth-facebook"
|
||||
gem "omniauth-openid", "~> 1.0.1"
|
||||
gem "webrat", "0.7.3", require: false
|
||||
gem "mocha", "~> 1.1", require: false
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "activerecord-jdbc-adapter"
|
||||
gem "activerecord-jdbcsqlite3-adapter"
|
||||
gem "jruby-openssl"
|
||||
end
|
||||
|
||||
platforms :ruby do
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
# TODO:
|
||||
# group :mongoid do
|
||||
# gem "mongoid", "~> 4.0.0"
|
||||
# end
|
||||
@@ -1,199 +0,0 @@
|
||||
GIT
|
||||
remote: git://github.com/rails/activemodel-serializers-xml.git
|
||||
revision: f380ea5ddefcb9a37f4fbc47606ed6fbecdb2b2a
|
||||
specs:
|
||||
activemodel-serializers-xml (1.0.0)
|
||||
activemodel (> 5.x)
|
||||
activerecord (> 5.x)
|
||||
activesupport (> 5.x)
|
||||
builder (~> 3.1)
|
||||
|
||||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
devise (4.0.0.rc2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0, < 5.1)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.0.0.beta3)
|
||||
actionpack (= 5.0.0.beta3)
|
||||
nio4r (~> 1.2)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.0.0.beta3)
|
||||
actionpack (= 5.0.0.beta3)
|
||||
actionview (= 5.0.0.beta3)
|
||||
activejob (= 5.0.0.beta3)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (5.0.0.beta3)
|
||||
actionview (= 5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
rack (~> 2.x)
|
||||
rack-test (~> 0.6.3)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
activejob (5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
activerecord (5.0.0.beta3)
|
||||
activemodel (= 5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
arel (~> 7.0)
|
||||
activesupport (5.0.0.beta3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (7.0.0)
|
||||
bcrypt (3.1.11)
|
||||
builder (3.2.2)
|
||||
concurrent-ruby (1.0.1)
|
||||
erubis (2.7.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
hashie (3.4.3)
|
||||
i18n (0.7.0)
|
||||
json (1.8.3)
|
||||
jwt (1.5.1)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.4)
|
||||
mime-types (>= 1.16, < 4)
|
||||
metaclass (0.0.4)
|
||||
method_source (0.8.2)
|
||||
mime-types (3.0)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0221)
|
||||
mini_portile2 (2.0.0)
|
||||
minitest (5.8.4)
|
||||
mocha (1.1.0)
|
||||
metaclass (~> 0.0.1)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nio4r (1.2.1)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
oauth2 (1.1.0)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 1.0, < 1.5.2)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.3.1)
|
||||
hashie (>= 1.2, < 4)
|
||||
rack (>= 1.0, < 3)
|
||||
omniauth-facebook (3.0.0)
|
||||
omniauth-oauth2 (~> 1.2)
|
||||
omniauth-oauth2 (1.4.0)
|
||||
oauth2 (~> 1.0)
|
||||
omniauth (~> 1.2)
|
||||
omniauth-openid (1.0.1)
|
||||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.5.0)
|
||||
rack (2.0.0.alpha)
|
||||
json
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (5.0.0.beta3)
|
||||
actioncable (= 5.0.0.beta3)
|
||||
actionmailer (= 5.0.0.beta3)
|
||||
actionpack (= 5.0.0.beta3)
|
||||
actionview (= 5.0.0.beta3)
|
||||
activejob (= 5.0.0.beta3)
|
||||
activemodel (= 5.0.0.beta3)
|
||||
activerecord (= 5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 5.0.0.beta3)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (0.1.1)
|
||||
actionpack (~> 5.x)
|
||||
actionview (~> 5.x)
|
||||
activesupport (~> 5.x)
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.3)
|
||||
loofah (~> 2.0)
|
||||
railties (5.0.0.beta3)
|
||||
actionpack (= 5.0.0.beta3)
|
||||
activesupport (= 5.0.0.beta3)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (11.1.2)
|
||||
rdoc (4.2.2)
|
||||
json (~> 1.4)
|
||||
responders (2.1.2)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
ruby-openid (2.7.0)
|
||||
sprockets (3.6.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.0.4)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.3.11)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
warden (1.2.6)
|
||||
rack (>= 1.0)
|
||||
webrat (0.7.3)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
websocket-driver (0.6.3)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activemodel-serializers-xml!
|
||||
activerecord-jdbc-adapter
|
||||
activerecord-jdbcsqlite3-adapter
|
||||
devise!
|
||||
jruby-openssl
|
||||
mocha (~> 1.1)
|
||||
oauth2
|
||||
omniauth (~> 1.3)
|
||||
omniauth-facebook
|
||||
omniauth-oauth2 (>= 1.2.0, < 1.5.0)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
rails (= 5.0.0.beta3)
|
||||
rails-controller-testing
|
||||
rdoc
|
||||
responders (~> 2.1.1)
|
||||
sqlite3
|
||||
webrat (= 0.7.3)
|
||||
|
||||
BUNDLED WITH
|
||||
1.11.2
|
||||
106
guides/bug_report_templates/integration_test.rb
Normal file
106
guides/bug_report_templates/integration_test.rb
Normal file
@@ -0,0 +1,106 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'bundler/inline'
|
||||
rescue LoadError => e
|
||||
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
|
||||
raise e
|
||||
end
|
||||
|
||||
gemfile(true) do
|
||||
source 'https://rubygems.org'
|
||||
# Activate the gem you are reporting the issue against.
|
||||
gem 'rails', '~> 4.2.0'
|
||||
gem 'devise', '~> 4.0'
|
||||
gem 'sqlite3'
|
||||
gem 'byebug'
|
||||
end
|
||||
|
||||
require 'rack/test'
|
||||
require 'action_controller/railtie'
|
||||
require 'active_record'
|
||||
require 'devise/rails/routes'
|
||||
require 'devise/rails/warden_compat'
|
||||
|
||||
ActiveRecord::Base.establish_connection( adapter: :sqlite3, database: ':memory:')
|
||||
|
||||
class DeviseCreateUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table(:users) do |t|
|
||||
t.string :email, null: false
|
||||
t.string :encrypted_password, null: true
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Devise.setup do |config|
|
||||
require 'devise/orm/active_record'
|
||||
config.secret_key = 'secret_key_base'
|
||||
end
|
||||
|
||||
class TestApp < Rails::Application
|
||||
config.root = File.dirname(__FILE__)
|
||||
config.session_store :cookie_store, key: 'cookie_store_key'
|
||||
secrets.secret_token = 'secret_token'
|
||||
secrets.secret_key_base = 'secret_key_base'
|
||||
config.eager_load = false
|
||||
|
||||
config.middleware.use Warden::Manager do |config|
|
||||
Devise.warden_config = config
|
||||
end
|
||||
|
||||
config.logger = Logger.new($stdout)
|
||||
Rails.logger = config.logger
|
||||
|
||||
end
|
||||
|
||||
Rails.application.initialize!
|
||||
|
||||
DeviseCreateUsers.migrate(:up)
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
devise :database_authenticatable
|
||||
end
|
||||
|
||||
Rails.application.routes.draw do
|
||||
devise_for :users
|
||||
|
||||
get '/' => 'test#index'
|
||||
end
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
class TestController < ApplicationController
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
render plain: 'Home'
|
||||
end
|
||||
end
|
||||
|
||||
require 'minitest/autorun'
|
||||
|
||||
class BugTest < ActionDispatch::IntegrationTest
|
||||
include Rack::Test::Methods
|
||||
include Warden::Test::Helpers
|
||||
|
||||
def test_returns_success
|
||||
Warden.test_mode!
|
||||
|
||||
login_as User.create!(email: 'test@test.com', password: 'test123456', password_confirmation: 'test123456')
|
||||
|
||||
get '/'
|
||||
assert last_response.ok?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def app
|
||||
Rails.application
|
||||
end
|
||||
end
|
||||
204
lib/devise.rb
204
lib/devise.rb
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails'
|
||||
require 'active_support/core_ext/numeric/time'
|
||||
require 'active_support/dependencies'
|
||||
@@ -11,15 +13,18 @@ module Devise
|
||||
autoload :Encryptor, 'devise/encryptor'
|
||||
autoload :FailureApp, 'devise/failure_app'
|
||||
autoload :OmniAuth, 'devise/omniauth'
|
||||
autoload :Orm, 'devise/orm'
|
||||
autoload :ParameterFilter, 'devise/parameter_filter'
|
||||
autoload :ParameterSanitizer, 'devise/parameter_sanitizer'
|
||||
autoload :TestHelpers, 'devise/test_helpers'
|
||||
autoload :TimeInflector, 'devise/time_inflector'
|
||||
autoload :TokenGenerator, 'devise/token_generator'
|
||||
autoload :SecretKeyFinder, 'devise/secret_key_finder'
|
||||
|
||||
module Controllers
|
||||
autoload :Helpers, 'devise/controllers/helpers'
|
||||
autoload :Rememberable, 'devise/controllers/rememberable'
|
||||
autoload :Responder, 'devise/controllers/responder'
|
||||
autoload :ScopedViews, 'devise/controllers/scoped_views'
|
||||
autoload :SignInOut, 'devise/controllers/sign_in_out'
|
||||
autoload :StoreLocation, 'devise/controllers/store_location'
|
||||
@@ -39,13 +44,18 @@ module Devise
|
||||
autoload :Authenticatable, 'devise/strategies/authenticatable'
|
||||
end
|
||||
|
||||
module Test
|
||||
autoload :ControllerHelpers, 'devise/test/controller_helpers'
|
||||
autoload :IntegrationHelpers, 'devise/test/integration_helpers'
|
||||
end
|
||||
|
||||
# Constants which holds devise configuration for extensions. Those should
|
||||
# not be modified by the "end user" (this is why they are constants).
|
||||
ALL = []
|
||||
CONTROLLERS = ActiveSupport::OrderedHash.new
|
||||
ROUTES = ActiveSupport::OrderedHash.new
|
||||
STRATEGIES = ActiveSupport::OrderedHash.new
|
||||
URL_HELPERS = ActiveSupport::OrderedHash.new
|
||||
CONTROLLERS = {}
|
||||
ROUTES = {}
|
||||
STRATEGIES = {}
|
||||
URL_HELPERS = {}
|
||||
|
||||
# Strategies that do not require user input.
|
||||
NO_INPUT = []
|
||||
@@ -53,12 +63,6 @@ module Devise
|
||||
# True values used to check params
|
||||
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
||||
|
||||
# Track the configs that user explicit changed the default value. It is
|
||||
# helpfull to not warn users about default values changing when they willing
|
||||
# changed.
|
||||
mattr_accessor :app_set_configs
|
||||
@@app_set_configs = Set.new
|
||||
|
||||
# Secret key used by the key generator
|
||||
mattr_accessor :secret_key
|
||||
@@secret_key = nil
|
||||
@@ -69,7 +73,7 @@ module Devise
|
||||
|
||||
# The number of times to hash the password.
|
||||
mattr_accessor :stretches
|
||||
@@stretches = 11
|
||||
@@stretches = 12
|
||||
|
||||
# The default key used when authenticating over http auth.
|
||||
mattr_accessor :http_authentication_key
|
||||
@@ -88,19 +92,8 @@ module Devise
|
||||
@@case_insensitive_keys = [:email]
|
||||
|
||||
# Keys that should have whitespace stripped.
|
||||
# TODO: 4.1 Do: @@strip_whitespace_keys = [:email]
|
||||
mattr_reader :strip_whitespace_keys
|
||||
@@strip_whitespace_keys = []
|
||||
|
||||
def self.strip_whitespace_keys=(strip_whitespace_keys)
|
||||
app_set_configs << :strip_whitespace_keys
|
||||
@@strip_whitespace_keys = strip_whitespace_keys
|
||||
end
|
||||
|
||||
def strip_whitespace_keys=(strip_whitespace_keys)
|
||||
app_set_configs << :strip_whitespace_keys
|
||||
@@strip_whitespace_keys = strip_whitespace_keys
|
||||
end
|
||||
mattr_accessor :strip_whitespace_keys
|
||||
@@strip_whitespace_keys = [:email]
|
||||
|
||||
# If http authentication is enabled by default.
|
||||
mattr_accessor :http_authenticatable
|
||||
@@ -118,22 +111,11 @@ module Devise
|
||||
mattr_accessor :http_authentication_realm
|
||||
@@http_authentication_realm = "Application"
|
||||
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
# an one (and only one) @ exists in the given string. This is mainly
|
||||
# to give user feedback and not to assert the e-mail validity.
|
||||
# TODO: 4.1 Do: @@email_regexp = [/\A[^@\s]+@[^@\s]+\z/]
|
||||
mattr_reader :email_regexp
|
||||
@@email_regexp = /\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/
|
||||
|
||||
def self.email_regexp=(email_regexp)
|
||||
app_set_configs << :email_regexp
|
||||
@@email_regexp = email_regexp
|
||||
end
|
||||
|
||||
def email_regexp=(email_regexp)
|
||||
app_set_configs << :email_regexp
|
||||
@@email_regexp = email_regexp
|
||||
end
|
||||
# Email regex used to validate email formats. It asserts that there are no
|
||||
# @ symbols or whitespaces in either the localpart or the domain, and that
|
||||
# there is a single @ symbol separating the localpart and the domain.
|
||||
mattr_accessor :email_regexp
|
||||
@@email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
||||
|
||||
# Range validation for password length
|
||||
mattr_accessor :password_length
|
||||
@@ -165,30 +147,22 @@ module Devise
|
||||
@@confirmation_keys = [:email]
|
||||
|
||||
# Defines if email should be reconfirmable.
|
||||
# False by default for backwards compatibility.
|
||||
# TODO: 4.1 Do: @@reconfirmable = true
|
||||
mattr_reader :reconfirmable
|
||||
@@reconfirmable = false
|
||||
|
||||
def self.reconfirmable=(reconfirmable)
|
||||
app_set_configs << :reconfirmable
|
||||
@@reconfirmable = reconfirmable
|
||||
end
|
||||
|
||||
def reconfirmable=(reconfirmable)
|
||||
app_set_configs << :reconfirmable
|
||||
@@reconfirmable = reconfirmable
|
||||
end
|
||||
mattr_accessor :reconfirmable
|
||||
@@reconfirmable = true
|
||||
|
||||
# Time interval to timeout the user session without activity.
|
||||
mattr_accessor :timeout_in
|
||||
@@timeout_in = 30.minutes
|
||||
|
||||
# Used to hash the password. Please generate one with rake secret.
|
||||
# Used to hash the password. Please generate one with rails secret.
|
||||
mattr_accessor :pepper
|
||||
@@pepper = nil
|
||||
|
||||
# Used to enable sending notification to user when their password is changed
|
||||
# Used to send notification to the original user email when their email is changed.
|
||||
mattr_accessor :send_email_changed_notification
|
||||
@@send_email_changed_notification = false
|
||||
|
||||
# Used to enable sending notification to user when their password is changed.
|
||||
mattr_accessor :send_password_change_notification
|
||||
@@send_password_change_notification = false
|
||||
|
||||
@@ -240,42 +214,29 @@ module Devise
|
||||
@@mailer_sender = nil
|
||||
|
||||
# Skip session storage for the following strategies
|
||||
# TODO: 4.1 Do: @@skip_session_storage = [:http_auth]
|
||||
mattr_reader :skip_session_storage
|
||||
@@skip_session_storage = []
|
||||
|
||||
def self.skip_session_storage=(skip_session_storage)
|
||||
app_set_configs << :skip_session_storage
|
||||
@@skip_session_storage = skip_session_storage
|
||||
end
|
||||
|
||||
def skip_session_storage=(skip_session_storage)
|
||||
app_set_configs << :skip_session_storage
|
||||
@@skip_session_storage = skip_session_storage
|
||||
end
|
||||
mattr_accessor :skip_session_storage
|
||||
@@skip_session_storage = [:http_auth]
|
||||
|
||||
# Which formats should be treated as navigational.
|
||||
mattr_accessor :navigational_formats
|
||||
@@navigational_formats = ["*/*", :html]
|
||||
@@navigational_formats = ["*/*", :html, :turbo_stream]
|
||||
|
||||
# The default responder used by Devise, used to customize status codes with:
|
||||
#
|
||||
# `config.responder.error_status`
|
||||
# `config.responder.redirect_status`
|
||||
#
|
||||
# Can be replaced by a custom application responder.
|
||||
mattr_accessor :responder
|
||||
@@responder = Devise::Controllers::Responder
|
||||
|
||||
# When set to true, signing out a user signs out all other scopes.
|
||||
mattr_accessor :sign_out_all_scopes
|
||||
@@sign_out_all_scopes = true
|
||||
|
||||
# The default method used while signing out
|
||||
# TODO: 4.1 Do: @@sign_out_via = :delete
|
||||
mattr_reader :sign_out_via
|
||||
@@sign_out_via = :get
|
||||
|
||||
def self.sign_out_via=(sign_out_via)
|
||||
app_set_configs << :sign_out_via
|
||||
@@sign_out_via = sign_out_via
|
||||
end
|
||||
|
||||
def sign_out_via=(sign_out_via)
|
||||
app_set_configs << :sign_out_via
|
||||
@@sign_out_via = sign_out_via
|
||||
end
|
||||
mattr_accessor :sign_out_via
|
||||
@@sign_out_via = :delete
|
||||
|
||||
# The parent controller all Devise controllers inherits from.
|
||||
# Defaults to ApplicationController. This should be set early
|
||||
@@ -304,15 +265,22 @@ module Devise
|
||||
mattr_accessor :clean_up_csrf_token_on_authentication
|
||||
@@clean_up_csrf_token_on_authentication = true
|
||||
|
||||
# When false, Devise will not attempt to reload routes on eager load.
|
||||
# This can reduce the time taken to boot the app but if your application
|
||||
# requires the Devise mappings to be loaded during boot time the application
|
||||
# won't boot properly.
|
||||
mattr_accessor :reload_routes
|
||||
@@reload_routes = true
|
||||
|
||||
# PRIVATE CONFIGURATION
|
||||
|
||||
# Store scopes mappings.
|
||||
mattr_reader :mappings
|
||||
@@mappings = ActiveSupport::OrderedHash.new
|
||||
@@mappings = {}
|
||||
|
||||
# OmniAuth configurations.
|
||||
mattr_reader :omniauth_configs
|
||||
@@omniauth_configs = ActiveSupport::OrderedHash.new
|
||||
@@omniauth_configs = {}
|
||||
|
||||
# Define a set of modules that are called when a mapping is added.
|
||||
mattr_reader :helpers
|
||||
@@ -336,55 +304,37 @@ module Devise
|
||||
mattr_accessor :token_generator
|
||||
@@token_generator = nil
|
||||
|
||||
# When set to false, changing a password does not automatically sign in a user
|
||||
mattr_accessor :sign_in_after_change_password
|
||||
@@sign_in_after_change_password = true
|
||||
|
||||
# Default way to set up Devise. Run rails generate devise_install to create
|
||||
# a fresh initializer with all configuration values.
|
||||
def self.setup
|
||||
yield self
|
||||
|
||||
warn_default_config_changed(:email_regexp, '/\A[^@\s]+@([^@\s]+\.)+[^@\W]+\z/', '/\A[^@\s]+@[^@\s]+\z/')
|
||||
warn_default_config_changed(:reconfirmable, 'false', 'true')
|
||||
warn_default_config_changed(:sign_out_via, ':get', ':delete')
|
||||
warn_default_config_changed(:skip_session_storage, '[]', '[:http_auth]')
|
||||
warn_default_config_changed(:strip_whitespace_keys, '[]', '[:email]')
|
||||
end
|
||||
|
||||
def self.warn_default_config_changed(config, current_default, new_default)
|
||||
unless app_set_configs.include?(config)
|
||||
warn = <<-MESSAGE.strip_heredoc
|
||||
[Devise] config.#{config} will have a new default on Devise 4.1
|
||||
To keep the current behavior please set in your config/initializers/devise.rb the following:
|
||||
|
||||
Devise.setup do |config|
|
||||
config.#{config} = #{current_default}
|
||||
end
|
||||
|
||||
If you want to use the new default:
|
||||
|
||||
Devise.setup do |config|
|
||||
config.#{config} = #{new_default}
|
||||
end
|
||||
MESSAGE
|
||||
ActiveSupport::Deprecation.warn(warn)
|
||||
end
|
||||
end
|
||||
|
||||
class Getter
|
||||
def initialize name
|
||||
def initialize(name)
|
||||
@name = name
|
||||
end
|
||||
|
||||
def get
|
||||
ActiveSupport::Dependencies.constantize(@name)
|
||||
# TODO: Remove AS::Dependencies usage when dropping support to Rails < 7.
|
||||
if ActiveSupport::Dependencies.respond_to?(:constantize)
|
||||
ActiveSupport::Dependencies.constantize(@name)
|
||||
else
|
||||
@name.constantize
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.ref(arg)
|
||||
if defined?(ActiveSupport::Dependencies::ClassCache)
|
||||
ActiveSupport::Dependencies::reference(arg)
|
||||
Getter.new(arg)
|
||||
else
|
||||
ActiveSupport::Dependencies.ref(arg)
|
||||
# TODO: Remove AS::Dependencies usage when dropping support to Rails < 7.
|
||||
if ActiveSupport::Dependencies.respond_to?(:reference)
|
||||
ActiveSupport::Dependencies.reference(arg)
|
||||
end
|
||||
Getter.new(arg)
|
||||
end
|
||||
|
||||
def self.available_router_name
|
||||
@@ -505,7 +455,6 @@ module Devise
|
||||
# config.omniauth :github, APP_ID, APP_SECRET
|
||||
#
|
||||
def self.omniauth(provider, *args)
|
||||
@@helpers << Devise::OmniAuth::UrlHelpers
|
||||
config = Devise::OmniAuth::Config.new(provider, args)
|
||||
@@omniauth_configs[config.strategy_name.to_sym] = config
|
||||
end
|
||||
@@ -543,10 +492,7 @@ module Devise
|
||||
mapping.to.serialize_into_session(record)
|
||||
end
|
||||
|
||||
warden_config.serialize_from_session(mapping.name) do |key|
|
||||
# Previous versions contained an additional entry at the beginning of
|
||||
# key with the record's class name.
|
||||
args = key[-2, 2]
|
||||
warden_config.serialize_from_session(mapping.name) do |args|
|
||||
mapping.to.serialize_from_session(*args)
|
||||
end
|
||||
end
|
||||
@@ -574,6 +520,18 @@ module Devise
|
||||
b.each_byte { |byte| res |= byte ^ l.shift }
|
||||
res == 0
|
||||
end
|
||||
|
||||
def self.deprecator
|
||||
@deprecator ||= ActiveSupport::Deprecation.new("5.0", "Devise")
|
||||
end
|
||||
|
||||
def self.activerecord51? # :nodoc:
|
||||
deprecator.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] `Devise.activerecord51?` is deprecated and will be removed in the next major version.
|
||||
It is a non-public method that's no longer used internally, but that other libraries have been relying on.
|
||||
DEPRECATION
|
||||
defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
||||
end
|
||||
end
|
||||
|
||||
require 'warden'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
# Those helpers are convenience methods added to ApplicationController.
|
||||
@@ -34,16 +36,17 @@ module Devise
|
||||
# before_action ->{ authenticate_blogger! :admin } # Redirects to the admin login page
|
||||
# current_blogger :user # Preferably returns a User if one is signed in
|
||||
#
|
||||
def devise_group(group_name, opts={})
|
||||
def devise_group(group_name, opts = {})
|
||||
mappings = "[#{ opts[:contains].map { |m| ":#{m}" }.join(',') }]"
|
||||
|
||||
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
||||
def authenticate_#{group_name}!(favourite=nil, opts={})
|
||||
def authenticate_#{group_name}!(favorite = nil, opts = {})
|
||||
unless #{group_name}_signed_in?
|
||||
mappings = #{mappings}
|
||||
mappings.unshift mappings.delete(favourite.to_sym) if favourite
|
||||
mappings.unshift mappings.delete(favorite.to_sym) if favorite
|
||||
mappings.each do |mapping|
|
||||
opts[:scope] = mapping
|
||||
opts[:locale] = I18n.locale
|
||||
warden.authenticate!(opts) if !devise_controller? || opts.delete(:force)
|
||||
end
|
||||
end
|
||||
@@ -55,9 +58,9 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
def current_#{group_name}(favourite=nil)
|
||||
def current_#{group_name}(favorite = nil)
|
||||
mappings = #{mappings}
|
||||
mappings.unshift mappings.delete(favourite.to_sym) if favourite
|
||||
mappings.unshift mappings.delete(favorite.to_sym) if favorite
|
||||
mappings.each do |mapping|
|
||||
current = warden.authenticate(scope: mapping)
|
||||
return current if current
|
||||
@@ -111,8 +114,9 @@ module Devise
|
||||
mapping = mapping.name
|
||||
|
||||
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
||||
def authenticate_#{mapping}!(opts={})
|
||||
def authenticate_#{mapping}!(opts = {})
|
||||
opts[:scope] = :#{mapping}
|
||||
opts[:locale] = I18n.locale
|
||||
warden.authenticate!(opts) if !devise_controller? || opts.delete(:force)
|
||||
end
|
||||
|
||||
@@ -138,7 +142,7 @@ module Devise
|
||||
|
||||
# The main accessor for the warden proxy instance
|
||||
def warden
|
||||
request.env['warden']
|
||||
request.env['warden'] or raise MissingWarden
|
||||
end
|
||||
|
||||
# Return true if it's a devise_controller. false to all controllers unless
|
||||
@@ -250,7 +254,7 @@ module Devise
|
||||
# Overwrite Rails' handle unverified request to sign out all scopes,
|
||||
# clear run strategies and remove cached variables.
|
||||
def handle_unverified_request
|
||||
super # call the default behaviour which resets/nullifies/raises
|
||||
super # call the default behavior which resets/nullifies/raises
|
||||
request.env["devise.skip_storage"] = true
|
||||
sign_out_all_scopes(false)
|
||||
end
|
||||
@@ -266,7 +270,7 @@ module Devise
|
||||
# Check if flash messages should be emitted. Default is to do it on
|
||||
# navigational formats
|
||||
def is_flashing_format?
|
||||
is_navigational_format?
|
||||
request.respond_to?(:flash) && is_navigational_format?
|
||||
end
|
||||
|
||||
private
|
||||
@@ -277,4 +281,15 @@ module Devise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class MissingWarden < StandardError
|
||||
def initialize
|
||||
super "Devise could not find the `Warden::Proxy` instance on your request environment.\n" + \
|
||||
"Make sure that your application is loading Devise and Warden as expected and that " + \
|
||||
"the `Warden::Manager` middleware is present in your middleware stack.\n" + \
|
||||
"If you are seeing this on one of your tests, ensure that your tests are either " + \
|
||||
"executing the Rails middleware stack or that your tests are using the `Devise::Test::ControllerHelpers` " + \
|
||||
"module to inject the `request.env['warden']` object for you."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
# A module that may be optionally included in a controller in order
|
||||
@@ -18,7 +20,7 @@ module Devise
|
||||
|
||||
# Remembers the given resource by setting up a cookie
|
||||
def remember_me(resource)
|
||||
return if env["devise.skip_storage"]
|
||||
return if request.env["devise.skip_storage"]
|
||||
scope = Devise::Mapping.find_scope!(resource)
|
||||
resource.remember_me!
|
||||
cookies.signed[remember_key(resource, scope)] = remember_cookie_values(resource)
|
||||
|
||||
35
lib/devise/controllers/responder.rb
Normal file
35
lib/devise/controllers/responder.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
# Custom Responder to configure default statuses that only apply to Devise,
|
||||
# and allow to integrate more easily with Hotwire/Turbo.
|
||||
class Responder < ActionController::Responder
|
||||
if respond_to?(:error_status=) && respond_to?(:redirect_status=)
|
||||
self.error_status = :ok
|
||||
self.redirect_status = :found
|
||||
else
|
||||
# TODO: remove this support for older Rails versions, which aren't supported by Turbo
|
||||
# and/or responders. It won't allow configuring a custom response, but it allows Devise
|
||||
# to use these methods and defaults across the implementation more easily.
|
||||
def self.error_status
|
||||
:ok
|
||||
end
|
||||
|
||||
def self.redirect_status
|
||||
:found
|
||||
end
|
||||
|
||||
def self.error_status=(*)
|
||||
warn "[DEVISE] Setting the error status on the Devise responder has no effect with this " \
|
||||
"version of `responders`, please make sure you're using a newer version. Check the changelog for more info."
|
||||
end
|
||||
|
||||
def self.redirect_status=(*)
|
||||
warn "[DEVISE] Setting the redirect status on the Devise responder has no effect with this " \
|
||||
"version of `responders`, please make sure you're using a newer version. Check the changelog for more info."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
module ScopedViews
|
||||
|
||||
@@ -1,31 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
# Provide sign in and sign out functionality.
|
||||
# Included by default in all controllers.
|
||||
module SignInOut
|
||||
# Return true if the given scope is signed in session. If no scope given, return
|
||||
# true if any scope is signed in. Does not run authentication hooks.
|
||||
def signed_in?(scope=nil)
|
||||
# true if any scope is signed in. This will run authentication hooks, which may
|
||||
# cause exceptions to be thrown from this method; if you simply want to check
|
||||
# if a scope has already previously been authenticated without running
|
||||
# authentication hooks, you can directly call `warden.authenticated?(scope: scope)`
|
||||
def signed_in?(scope = nil)
|
||||
[scope || Devise.mappings.keys].flatten.any? do |_scope|
|
||||
warden.authenticate?(scope: _scope)
|
||||
end
|
||||
end
|
||||
|
||||
# Sign in a user that already was authenticated. This helper is useful for logging
|
||||
# users in after sign up.
|
||||
#
|
||||
# All options given to sign_in is passed forward to the set_user method in warden.
|
||||
# The only exception is the :bypass option, which bypass warden callbacks and stores
|
||||
# the user straight in session. This option is useful in cases the user is already
|
||||
# signed in, but we want to refresh the credentials in session.
|
||||
# users in after sign up. All options given to sign_in is passed forward
|
||||
# to the set_user method in warden.
|
||||
# If you are using a custom warden strategy and the timeoutable module, you have to
|
||||
# set `env["devise.skip_timeout"] = true` in the request to use this method, like we do
|
||||
# in the sessions controller: https://github.com/heartcombo/devise/blob/main/app/controllers/devise/sessions_controller.rb#L7
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# sign_in :user, @user # sign_in(scope, resource)
|
||||
# sign_in @user # sign_in(resource)
|
||||
# sign_in @user, event: :authentication # sign_in(resource, options)
|
||||
# sign_in @user, store: false # sign_in(resource, options)
|
||||
# sign_in @user, bypass: true # sign_in(resource, options)
|
||||
# sign_in @user, event: :authentication # sign_in(resource, options)
|
||||
# sign_in @user, store: false # sign_in(resource, options)
|
||||
#
|
||||
def sign_in(resource_or_scope, *args)
|
||||
options = args.extract_options!
|
||||
@@ -35,6 +38,13 @@ module Devise
|
||||
expire_data_after_sign_in!
|
||||
|
||||
if options[:bypass]
|
||||
Devise.deprecator.warn(<<-DEPRECATION.strip_heredoc, caller)
|
||||
[Devise] bypass option is deprecated and it will be removed in future version of Devise.
|
||||
Please use bypass_sign_in method instead.
|
||||
Example:
|
||||
|
||||
bypass_sign_in(user)
|
||||
DEPRECATION
|
||||
warden.session_serializer.store(resource, scope)
|
||||
elsif warden.user(scope) == resource && !options.delete(:force)
|
||||
# Do nothing. User already signed in and we are not forcing it.
|
||||
@@ -44,6 +54,20 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
# Sign in a user bypassing the warden callbacks and stores the user
|
||||
# straight in session. This option is useful in cases the user is already
|
||||
# signed in, but we want to refresh the credentials in session.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# bypass_sign_in @user, scope: :user
|
||||
# bypass_sign_in @user
|
||||
def bypass_sign_in(resource, scope: nil)
|
||||
scope ||= Devise::Mapping.find_scope!(resource)
|
||||
expire_data_after_sign_in!
|
||||
warden.session_serializer.store(resource, scope)
|
||||
end
|
||||
|
||||
# Sign out a given user or scope. This helper is useful for signing out a user
|
||||
# after deleting accounts. Returns true if there was a logout and false if there
|
||||
# is no user logged in on the referred scope
|
||||
@@ -53,12 +77,11 @@ module Devise
|
||||
# sign_out :user # sign_out(scope)
|
||||
# sign_out @user # sign_out(resource)
|
||||
#
|
||||
def sign_out(resource_or_scope=nil)
|
||||
def sign_out(resource_or_scope = nil)
|
||||
return sign_out_all_scopes unless resource_or_scope
|
||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||
user = warden.user(scope: scope, run_callbacks: false) # If there is no user
|
||||
|
||||
warden.raw_session.inspect # Without this inspect here. The session does not clear.
|
||||
warden.logout(scope)
|
||||
warden.clear_strategies_cache!(scope: scope)
|
||||
instance_variable_set(:"@current_#{scope}", nil)
|
||||
@@ -69,7 +92,7 @@ module Devise
|
||||
# Sign out all active users or scopes. This helper is useful for signing out all roles
|
||||
# in one click. This signs out ALL scopes in warden. Returns true if there was at least one logout
|
||||
# and false if there was no user logged in on all scopes.
|
||||
def sign_out_all_scopes(lock=true)
|
||||
def sign_out_all_scopes(lock = true)
|
||||
users = Devise.mappings.keys.map { |s| warden.user(scope: s, run_callbacks: false) }
|
||||
|
||||
warden.logout
|
||||
@@ -83,10 +106,12 @@ module Devise
|
||||
private
|
||||
|
||||
def expire_data_after_sign_in!
|
||||
# TODO: remove once Rails 5.2+ and forward are only supported.
|
||||
# session.keys will return an empty array if the session is not yet loaded.
|
||||
# This is a bug in both Rack and Rails.
|
||||
# A call to #empty? forces the session to be loaded.
|
||||
session.empty?
|
||||
|
||||
session.keys.grep(/^devise\./).each { |k| session.delete(k) }
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "uri"
|
||||
|
||||
module Devise
|
||||
@@ -29,16 +31,13 @@ module Devise
|
||||
# Example:
|
||||
#
|
||||
# store_location_for(:user, dashboard_path)
|
||||
# redirect_to user_omniauth_authorize_path(:facebook)
|
||||
# redirect_to user_facebook_omniauth_authorize_path
|
||||
#
|
||||
def store_location_for(resource_or_scope, location)
|
||||
session_key = stored_location_key_for(resource_or_scope)
|
||||
uri = parse_uri(location)
|
||||
if uri
|
||||
path = [uri.path.sub(/\A\/+/, '/'), uri.query].compact.join('?')
|
||||
path = [path, uri.fragment].compact.join('#')
|
||||
session[session_key] = path
|
||||
end
|
||||
|
||||
path = extract_path_from_location(location)
|
||||
session[session_key] = path if path
|
||||
end
|
||||
|
||||
private
|
||||
@@ -53,6 +52,25 @@ module Devise
|
||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||
"#{scope}_return_to"
|
||||
end
|
||||
|
||||
def extract_path_from_location(location)
|
||||
uri = parse_uri(location)
|
||||
|
||||
if uri
|
||||
path = remove_domain_from_uri(uri)
|
||||
path = add_fragment_back_to_path(uri, path)
|
||||
|
||||
path
|
||||
end
|
||||
end
|
||||
|
||||
def remove_domain_from_uri(uri)
|
||||
[uri.path.sub(/\A\/+/, '/'), uri.query].compact.join('?')
|
||||
end
|
||||
|
||||
def add_fragment_back_to_path(uri, path)
|
||||
[path, uri.fragment].compact.join('#')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Controllers
|
||||
# Create url helpers to be used with resource/scope configuration. Acts as
|
||||
@@ -32,7 +34,7 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
def self.generate_helpers!(routes=nil)
|
||||
def self.generate_helpers!(routes = nil)
|
||||
routes ||= begin
|
||||
mappings = Devise.mappings.values.map(&:used_helpers).flatten.uniq
|
||||
Devise::URL_HELPERS.slice(*mappings)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
# Checks the scope in the given environment and returns the associated failure app.
|
||||
class Delegator
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'bcrypt'
|
||||
|
||||
module Devise
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "action_controller/metal"
|
||||
|
||||
module Devise
|
||||
# Failure application that will be called every time :warden is thrown from
|
||||
# any strategy or hook. Responsible for redirect the user to the sign in
|
||||
# page based on current scope and mapping. If no scope is given, redirect
|
||||
# to the default_url.
|
||||
# any strategy or hook. It is responsible for redirecting the user to the sign
|
||||
# in page based on current scope and mapping. If no scope is given, it
|
||||
# redirects to the default_url.
|
||||
class FailureApp < ActionController::Metal
|
||||
include ActionController::UrlFor
|
||||
include ActionController::Redirecting
|
||||
@@ -16,6 +18,11 @@ module Devise
|
||||
|
||||
delegate :flash, to: :request
|
||||
|
||||
include AbstractController::Callbacks
|
||||
around_action do |failure_app, action|
|
||||
I18n.with_locale(failure_app.i18n_locale, &action)
|
||||
end
|
||||
|
||||
def self.call(env)
|
||||
@respond ||= action(:respond)
|
||||
@respond.call(env)
|
||||
@@ -50,13 +57,11 @@ module Devise
|
||||
end
|
||||
|
||||
def recall
|
||||
config = Rails.application.config
|
||||
|
||||
header_info = if config.try(:relative_url_root)
|
||||
base_path = Pathname.new(config.relative_url_root)
|
||||
header_info = if relative_url_root?
|
||||
base_path = Pathname.new(relative_url_root)
|
||||
full_path = Pathname.new(attempted_path)
|
||||
|
||||
{ "SCRIPT_NAME" => config.relative_url_root,
|
||||
{ "SCRIPT_NAME" => relative_url_root,
|
||||
"PATH_INFO" => '/' + full_path.relative_path_from(base_path).to_s }
|
||||
else
|
||||
{ "PATH_INFO" => attempted_path }
|
||||
@@ -66,13 +71,16 @@ module Devise
|
||||
if request.respond_to?(:set_header)
|
||||
request.set_header(var, value)
|
||||
else
|
||||
env[var] = value
|
||||
request.env[var] = value
|
||||
end
|
||||
end
|
||||
|
||||
flash.now[:alert] = i18n_message(:invalid) if is_flashing_format?
|
||||
# self.response = recall_app(warden_options[:recall]).call(env)
|
||||
self.response = recall_app(warden_options[:recall]).call(request.env)
|
||||
self.response = recall_app(warden_options[:recall]).call(request.env).tap { |response|
|
||||
response[0] = Rack::Utils.status_code(
|
||||
response[0].in?(300..399) ? Devise.responder.redirect_status : Devise.responder.error_status
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
def redirect
|
||||
@@ -103,16 +111,20 @@ module Devise
|
||||
options[:scope] = "devise.failure"
|
||||
options[:default] = [message]
|
||||
auth_keys = scope_class.authentication_keys
|
||||
keys = auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys
|
||||
options[:authentication_keys] = keys.join(I18n.translate(:"support.array.words_connector"))
|
||||
keys = (auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys).map { |key| scope_class.human_attribute_name(key) }
|
||||
options[:authentication_keys] = keys.join(I18n.t(:"support.array.words_connector"))
|
||||
options = i18n_options(options)
|
||||
|
||||
I18n.t(:"#{scope}.#{message}", options)
|
||||
I18n.t(:"#{scope}.#{message}", **options)
|
||||
else
|
||||
message.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def i18n_locale
|
||||
warden_options[:locale]
|
||||
end
|
||||
|
||||
def redirect_url
|
||||
if warden_message == :timeout
|
||||
flash[:timedout] = true if is_flashing_format?
|
||||
@@ -135,22 +147,29 @@ module Devise
|
||||
|
||||
def scope_url
|
||||
opts = {}
|
||||
|
||||
# Initialize script_name with nil to prevent infinite loops in
|
||||
# authenticated mounted engines in rails 4.2 and 5.0
|
||||
opts[:script_name] = nil
|
||||
|
||||
route = route(scope)
|
||||
|
||||
opts[:format] = request_format unless skip_format?
|
||||
|
||||
config = Rails.application.config
|
||||
|
||||
if config.respond_to?(:relative_url_root)
|
||||
# Rails 4.2 goes into an infinite loop if opts[:script_name] is unset
|
||||
rails_4_2 = (Rails::VERSION::MAJOR >= 4) && (Rails::VERSION::MINOR >= 2)
|
||||
if config.relative_url_root.present? || rails_4_2
|
||||
opts[:script_name] = config.relative_url_root
|
||||
end
|
||||
end
|
||||
|
||||
router_name = Devise.mappings[scope].router_name || Devise.available_router_name
|
||||
context = send(router_name)
|
||||
|
||||
if relative_url_root?
|
||||
opts[:script_name] = relative_url_root
|
||||
|
||||
# We need to add the rootpath to `script_name` manually for applications that use a Rails
|
||||
# version lower than 5.1. Otherwise, it is going to generate a wrong path for Engines
|
||||
# that use Devise. Remove it when the support of Rails 5.0 is dropped.
|
||||
elsif root_path_defined?(context) && !rails_51_and_up?
|
||||
rootpath = context.routes.url_helpers.root_path
|
||||
opts[:script_name] = rootpath.chomp('/') if rootpath.length > 1
|
||||
end
|
||||
|
||||
if context.respond_to?(route)
|
||||
context.send(route, opts)
|
||||
elsif respond_to?(:root_url)
|
||||
@@ -161,15 +180,15 @@ module Devise
|
||||
end
|
||||
|
||||
def skip_format?
|
||||
%w(html */*).include? request_format.to_s
|
||||
%w(html */* turbo_stream).include? request_format.to_s
|
||||
end
|
||||
|
||||
# Choose whether we should respond in a http authentication fashion,
|
||||
# Choose whether we should respond in an HTTP authentication fashion,
|
||||
# including 401 and optional headers.
|
||||
#
|
||||
# This method allows the user to explicitly disable http authentication
|
||||
# on ajax requests in case they want to redirect on failures instead of
|
||||
# handling the errors on their own. This is useful in case your ajax API
|
||||
# This method allows the user to explicitly disable HTTP authentication
|
||||
# on AJAX requests in case they want to redirect on failures instead of
|
||||
# handling the errors on their own. This is useful in case your AJAX API
|
||||
# is the same as your public API and uses a format like JSON (so you
|
||||
# cannot mark JSON as a navigational format).
|
||||
def http_auth?
|
||||
@@ -180,7 +199,7 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
# It does not make sense to send authenticate headers in ajax requests
|
||||
# It doesn't make sense to send authenticate headers in AJAX requests
|
||||
# or if the user disabled them.
|
||||
def http_auth_header?
|
||||
scope_class.http_authenticatable && !request.xhr?
|
||||
@@ -206,11 +225,11 @@ module Devise
|
||||
end
|
||||
|
||||
def warden
|
||||
request.respond_to?(:get_header) ? request.get_header("warden") : env["warden"]
|
||||
request.respond_to?(:get_header) ? request.get_header("warden") : request.env["warden"]
|
||||
end
|
||||
|
||||
def warden_options
|
||||
request.respond_to?(:get_header) ? request.get_header("warden.options") : env["warden.options"]
|
||||
request.respond_to?(:get_header) ? request.get_header("warden.options") : request.env["warden.options"]
|
||||
end
|
||||
|
||||
def warden_message
|
||||
@@ -229,10 +248,10 @@ module Devise
|
||||
warden_options[:attempted_path]
|
||||
end
|
||||
|
||||
# Stores requested uri to redirect the user after signing in. We cannot use
|
||||
# scoped session provided by warden here, since the user is not authenticated
|
||||
# yet, but we still need to store the uri based on scope, so different scopes
|
||||
# would never use the same uri to redirect.
|
||||
# Stores requested URI to redirect the user after signing in. We can't use
|
||||
# the scoped session provided by warden here, since the user is not
|
||||
# authenticated yet, but we still need to store the URI based on scope, so
|
||||
# different scopes would never use the same URI to redirect.
|
||||
def store_location!
|
||||
store_location_for(scope, attempted_path) if request.get? && !http_auth?
|
||||
end
|
||||
@@ -244,11 +263,35 @@ module Devise
|
||||
# Check if flash messages should be emitted. Default is to do it on
|
||||
# navigational formats
|
||||
def is_flashing_format?
|
||||
is_navigational_format?
|
||||
request.respond_to?(:flash) && is_navigational_format?
|
||||
end
|
||||
|
||||
def request_format
|
||||
@request_format ||= request.format.try(:ref)
|
||||
end
|
||||
|
||||
def relative_url_root
|
||||
@relative_url_root ||= begin
|
||||
config = Rails.application.config
|
||||
|
||||
config.try(:relative_url_root) || config.action_controller.try(:relative_url_root)
|
||||
end
|
||||
end
|
||||
|
||||
def relative_url_root?
|
||||
relative_url_root.present?
|
||||
end
|
||||
|
||||
ActiveSupport.run_load_hooks(:devise_failure_app, self)
|
||||
|
||||
private
|
||||
|
||||
def root_path_defined?(context)
|
||||
defined?(context.routes) && context.routes.url_helpers.respond_to?(:root_path)
|
||||
end
|
||||
|
||||
def rails_51_and_up?
|
||||
Rails.gem_version >= Gem::Version.new("5.1")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Deny user access whenever their account is not active yet.
|
||||
# We need this as hook to validate the user activity on each request
|
||||
# and in case the user is using other strategies beside Devise ones.
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Warden::Manager.after_authentication do |record, warden, options|
|
||||
clean_up_for_winning_strategy = !warden.winning_strategy.respond_to?(:clean_up_csrf?) ||
|
||||
warden.winning_strategy.clean_up_csrf?
|
||||
if Devise.clean_up_csrf_token_on_authentication && clean_up_for_winning_strategy
|
||||
warden.request.session.try(:delete, :_csrf_token)
|
||||
if warden.request.respond_to?(:reset_csrf_token)
|
||||
# Rails 7.1+
|
||||
warden.request.reset_csrf_token
|
||||
else
|
||||
warden.request.session.try(:delete, :_csrf_token)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Before logout hook to forget the user in the given scope, if it responds
|
||||
# to forget_me! Also clear remember token to ensure the user won't be
|
||||
# remembered again. Notice that we forget the user unless the record is not persisted.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# After each sign in, if resource responds to failed_attempts, sets it to 0
|
||||
# This is only triggered when the user is explicitly set (with set_user)
|
||||
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
|
||||
if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope])
|
||||
record.update_attribute(:failed_attempts, 0) unless record.failed_attempts.to_i.zero?
|
||||
if record.respond_to?(:reset_failed_attempts!) && warden.authenticated?(options[:scope])
|
||||
record.reset_failed_attempts!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Hooks
|
||||
# A small warden proxy so we can remember, forget and
|
||||
@@ -7,7 +9,7 @@ module Devise
|
||||
include Devise::Controllers::SignInOut
|
||||
|
||||
attr_reader :warden
|
||||
delegate :cookies, :env, to: :warden
|
||||
delegate :cookies, :request, to: :warden
|
||||
|
||||
def initialize(warden)
|
||||
@warden = warden
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
|
||||
scope = options[:scope]
|
||||
if record.respond_to?(:remember_me) && options[:store] != false &&
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Each time a record is set we check whether its session has already timed out
|
||||
# or not, based on last request time. If so, the record is logged out and
|
||||
# redirected to the sign in page. Also, each time the request comes and the
|
||||
@@ -19,8 +21,8 @@ Warden::Manager.after_set_user do |record, warden, options|
|
||||
|
||||
proxy = Devise::Hooks::Proxy.new(warden)
|
||||
|
||||
if record.timedout?(last_request_at) &&
|
||||
!env['devise.skip_timeout'] &&
|
||||
if !env['devise.skip_timeout'] &&
|
||||
record.timedout?(last_request_at) &&
|
||||
!proxy.remember_me_is_active?(record)
|
||||
Devise.sign_out_all_scopes ? proxy.sign_out : proxy.sign_out(scope)
|
||||
throw :warden, scope: scope, message: :timeout
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# After each sign in, update sign in time, sign in count and sign in IP.
|
||||
# This is only triggered when the user is explicitly set (with set_user)
|
||||
# and on authentication. Retrieving the user from session (:fetch) does
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Mailers
|
||||
module Helpers
|
||||
@@ -5,15 +7,16 @@ module Devise
|
||||
|
||||
included do
|
||||
include Devise::Controllers::ScopedViews
|
||||
attr_reader :scope_name, :resource
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
attr_reader :scope_name, :resource
|
||||
|
||||
# Configure default email options
|
||||
def devise_mail(record, action, opts={})
|
||||
def devise_mail(record, action, opts = {}, &block)
|
||||
initialize_from_record(record)
|
||||
mail headers_for(action, opts)
|
||||
mail headers_for(action, opts), &block
|
||||
end
|
||||
|
||||
def initialize_from_record(record)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
# Responsible for handling devise mappings and routes configuration. Each
|
||||
# resource configured by devise_for in routes is actually creating a mapping
|
||||
@@ -44,7 +46,7 @@ module Devise
|
||||
raise "Could not find a valid mapping for #{obj.inspect}"
|
||||
end
|
||||
|
||||
def self.find_by_path!(path, path_type=:fullpath)
|
||||
def self.find_by_path!(path, path_type = :fullpath)
|
||||
Devise.mappings.each_value { |m| return m if path.include?(m.send(path_type)) }
|
||||
raise "Could not find a valid mapping for path #{path.inspect}"
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
class MissingAttribute < StandardError
|
||||
@@ -12,7 +14,7 @@ module Devise
|
||||
|
||||
# Creates configuration values for Devise and for the given module.
|
||||
#
|
||||
# Devise::Models.config(Devise::DatabaseAuthenticatable, :stretches)
|
||||
# Devise::Models.config(Devise::Models::DatabaseAuthenticatable, :stretches)
|
||||
#
|
||||
# The line above creates:
|
||||
#
|
||||
@@ -82,6 +84,7 @@ module Devise
|
||||
end
|
||||
|
||||
devise_modules_hook! do
|
||||
include Devise::Orm
|
||||
include Devise::Models::Authenticatable
|
||||
|
||||
selected_modules.each do |m|
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
require 'active_model/version'
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/hooks/activatable'
|
||||
require 'devise/hooks/csrf_cleaner'
|
||||
require 'devise/rails/deprecated_constant_accessor'
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
@@ -8,7 +10,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Authenticatable adds the following options to devise_for:
|
||||
# Authenticatable adds the following options to +devise+:
|
||||
#
|
||||
# * +authentication_keys+: parameters used for authentication. By default [:email].
|
||||
#
|
||||
@@ -54,11 +56,14 @@ module Devise
|
||||
module Authenticatable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
BLACKLIST_FOR_SERIALIZATION = [:encrypted_password, :reset_password_token, :reset_password_sent_at,
|
||||
UNSAFE_ATTRIBUTES_FOR_SERIALIZATION = [:encrypted_password, :reset_password_token, :reset_password_sent_at,
|
||||
:remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip,
|
||||
:last_sign_in_ip, :password_salt, :confirmation_token, :confirmed_at, :confirmation_sent_at,
|
||||
:remember_token, :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at]
|
||||
|
||||
include Devise::DeprecatedConstantAccessor
|
||||
deprecate_constant "BLACKLIST_FOR_SERIALIZATION", "Devise::Models::Authenticatable::UNSAFE_ATTRIBUTES_FOR_SERIALIZATION", deprecator: Devise.deprecator
|
||||
|
||||
included do
|
||||
class_attribute :devise_modules, instance_writer: false
|
||||
self.devise_modules ||= []
|
||||
@@ -102,18 +107,27 @@ module Devise
|
||||
# and passing a new list of attributes you want to exempt. All attributes
|
||||
# given to :except will simply add names to exempt to Devise internal list.
|
||||
def serializable_hash(options = nil)
|
||||
options ||= {}
|
||||
options[:except] = Array(options[:except])
|
||||
options = options.try(:dup) || {}
|
||||
options[:except] = Array(options[:except]).dup
|
||||
|
||||
if options[:force_except]
|
||||
options[:except].concat Array(options[:force_except])
|
||||
else
|
||||
options[:except].concat BLACKLIST_FOR_SERIALIZATION
|
||||
options[:except].concat UNSAFE_ATTRIBUTES_FOR_SERIALIZATION
|
||||
end
|
||||
|
||||
super(options)
|
||||
end
|
||||
|
||||
# Redefine inspect using serializable_hash, to ensure we don't accidentally
|
||||
# leak passwords into exceptions.
|
||||
def inspect
|
||||
inspection = serializable_hash.collect do |k,v|
|
||||
"#{k}: #{respond_to?(:attribute_for_inspect) ? attribute_for_inspect(k) : v.inspect}"
|
||||
end
|
||||
"#<#{self.class} #{inspection.join(", ")}>"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def devise_mailer
|
||||
@@ -123,16 +137,18 @@ module Devise
|
||||
# This is an internal method called every time Devise needs
|
||||
# to send a notification/mail. This can be overridden if you
|
||||
# need to customize the e-mail delivery logic. For instance,
|
||||
# if you are using a queue to deliver e-mails (delayed job,
|
||||
# sidekiq, resque, etc), you must add the delivery to the queue
|
||||
# if you are using a queue to deliver e-mails (active job, delayed
|
||||
# job, sidekiq, resque, etc), you must add the delivery to the queue
|
||||
# just after the transaction was committed. To achieve this,
|
||||
# you can override send_devise_notification to store the
|
||||
# deliveries until the after_commit callback is triggered:
|
||||
# deliveries until the after_commit callback is triggered.
|
||||
#
|
||||
# The following example uses Active Job's `deliver_later` :
|
||||
#
|
||||
# class User
|
||||
# devise :database_authenticatable, :confirmable
|
||||
#
|
||||
# after_commit :send_pending_notifications
|
||||
# after_commit :send_pending_devise_notifications
|
||||
#
|
||||
# protected
|
||||
#
|
||||
@@ -140,27 +156,45 @@ module Devise
|
||||
# # If the record is new or changed then delay the
|
||||
# # delivery until the after_commit callback otherwise
|
||||
# # send now because after_commit will not be called.
|
||||
# if new_record? || changed?
|
||||
# pending_notifications << [notification, args]
|
||||
# # For Rails < 6 use `changed?` instead of `saved_changes?`.
|
||||
# if new_record? || saved_changes?
|
||||
# pending_devise_notifications << [notification, args]
|
||||
# else
|
||||
# devise_mailer.send(notification, self, *args).deliver
|
||||
# render_and_send_devise_message(notification, *args)
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def send_pending_notifications
|
||||
# pending_notifications.each do |notification, args|
|
||||
# devise_mailer.send(notification, self, *args).deliver
|
||||
# private
|
||||
#
|
||||
# def send_pending_devise_notifications
|
||||
# pending_devise_notifications.each do |notification, args|
|
||||
# render_and_send_devise_message(notification, *args)
|
||||
# end
|
||||
#
|
||||
# # Empty the pending notifications array because the
|
||||
# # after_commit hook can be called multiple times which
|
||||
# # could cause multiple emails to be sent.
|
||||
# pending_notifications.clear
|
||||
# pending_devise_notifications.clear
|
||||
# end
|
||||
#
|
||||
# def pending_notifications
|
||||
# @pending_notifications ||= []
|
||||
# def pending_devise_notifications
|
||||
# @pending_devise_notifications ||= []
|
||||
# end
|
||||
#
|
||||
# def render_and_send_devise_message(notification, *args)
|
||||
# message = devise_mailer.send(notification, self, *args)
|
||||
#
|
||||
# # Deliver later with Active Job's `deliver_later`
|
||||
# if message.respond_to?(:deliver_later)
|
||||
# message.deliver_later
|
||||
# # Remove once we move to Rails 4.2+ only, as `deliver` is deprecated.
|
||||
# elsif message.respond_to?(:deliver_now)
|
||||
# message.deliver_now
|
||||
# else
|
||||
# message.deliver
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# end
|
||||
#
|
||||
def send_devise_notification(notification, *args)
|
||||
@@ -235,46 +269,38 @@ module Devise
|
||||
# end
|
||||
#
|
||||
# Finally, notice that Devise also queries for users in other scenarios
|
||||
# besides authentication, for example when retrieving an user to send
|
||||
# besides authentication, for example when retrieving a user to send
|
||||
# an e-mail for password reset. In such cases, find_for_authentication
|
||||
# is not called.
|
||||
def find_for_authentication(tainted_conditions)
|
||||
find_first_by_auth_conditions(tainted_conditions)
|
||||
end
|
||||
|
||||
def find_first_by_auth_conditions(tainted_conditions, opts={})
|
||||
def find_first_by_auth_conditions(tainted_conditions, opts = {})
|
||||
to_adapter.find_first(devise_parameter_filter.filter(tainted_conditions).merge(opts))
|
||||
end
|
||||
|
||||
# Find or initialize a record setting an error if it can't be found.
|
||||
def find_or_initialize_with_error_by(attribute, value, error=:invalid) #:nodoc:
|
||||
def find_or_initialize_with_error_by(attribute, value, error = :invalid) #:nodoc:
|
||||
find_or_initialize_with_errors([attribute], { attribute => value }, error)
|
||||
end
|
||||
|
||||
# Find or initialize a record with group of attributes based on a list of required attributes.
|
||||
def find_or_initialize_with_errors(required_attributes, attributes, error=:invalid) #:nodoc:
|
||||
attributes = if attributes.respond_to? :permit!
|
||||
attributes.slice(*required_attributes).permit!.to_h.with_indifferent_access
|
||||
else
|
||||
attributes.with_indifferent_access.slice(*required_attributes)
|
||||
end
|
||||
attributes.delete_if { |key, value| value.blank? }
|
||||
def find_or_initialize_with_errors(required_attributes, attributes, error = :invalid) #:nodoc:
|
||||
attributes.try(:permit!)
|
||||
attributes = attributes.to_h.with_indifferent_access
|
||||
.slice(*required_attributes)
|
||||
.delete_if { |key, value| value.blank? }
|
||||
|
||||
if attributes.size == required_attributes.size
|
||||
record = find_first_by_auth_conditions(attributes)
|
||||
record = find_first_by_auth_conditions(attributes) and return record
|
||||
end
|
||||
|
||||
unless record
|
||||
record = new
|
||||
|
||||
new(devise_parameter_filter.filter(attributes)).tap do |record|
|
||||
required_attributes.each do |key|
|
||||
value = attributes[key]
|
||||
record.send("#{key}=", value)
|
||||
record.errors.add(key, value.present? ? error : :blank)
|
||||
record.errors.add(key, attributes[key].blank? ? :blank : error)
|
||||
end
|
||||
end
|
||||
|
||||
record
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
# Confirmable is responsible to verify if an account is already confirmed to
|
||||
@@ -26,7 +28,9 @@ module Devise
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field to be set up (t.reconfirmable in migrations). Until confirmed, new email is
|
||||
# stored in unconfirmed email column, and copied to email column on successful
|
||||
# confirmation.
|
||||
# confirmation. Also, when used in conjunction with `send_email_changed_notification`,
|
||||
# the notification is sent to the original email when the change is requested,
|
||||
# not when the unconfirmed email is confirmed.
|
||||
# * +confirm_within+: the time before a sent confirmation token becomes invalid.
|
||||
# You can use this to force the user to confirm within a set period of time.
|
||||
# Confirmable will not generate a new token if a repeat confirmation is requested
|
||||
@@ -43,13 +47,20 @@ module Devise
|
||||
|
||||
included do
|
||||
before_create :generate_confirmation_token, if: :confirmation_required?
|
||||
after_create :send_on_create_confirmation_instructions, if: :send_confirmation_notification?
|
||||
after_create :skip_reconfirmation_in_callback!, if: :send_confirmation_notification?
|
||||
if Devise::Orm.active_record?(self) # ActiveRecord
|
||||
after_commit :send_on_create_confirmation_instructions, on: :create, if: :send_confirmation_notification?
|
||||
after_commit :send_reconfirmation_instructions, on: :update, if: :reconfirmation_required?
|
||||
else # Mongoid
|
||||
after_create :send_on_create_confirmation_instructions, if: :send_confirmation_notification?
|
||||
after_update :send_reconfirmation_instructions, if: :reconfirmation_required?
|
||||
end
|
||||
before_update :postpone_email_change_until_confirmation_and_regenerate_confirmation_token, if: :postpone_email_change?
|
||||
after_update :send_reconfirmation_instructions, if: :reconfirmation_required?
|
||||
end
|
||||
|
||||
def initialize(*args, &block)
|
||||
@bypass_confirmation_postpone = false
|
||||
@skip_reconfirmation_in_callback = false
|
||||
@reconfirmation_required = false
|
||||
@skip_confirmation_notification = false
|
||||
@raw_confirmation_token = nil
|
||||
@@ -65,7 +76,7 @@ module Devise
|
||||
# Confirm a user by setting it's confirmed_at to actual time. If the user
|
||||
# is already confirmed, add an error to email field. If the user is invalid
|
||||
# add errors
|
||||
def confirm(args={})
|
||||
def confirm(args = {})
|
||||
pending_any_confirmation do
|
||||
if confirmation_period_expired?
|
||||
self.errors.add(:email, :confirmation_period_expired,
|
||||
@@ -91,11 +102,6 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
def confirm!(args={})
|
||||
ActiveSupport::Deprecation.warn "confirm! is deprecated in favor of confirm"
|
||||
confirm(args)
|
||||
end
|
||||
|
||||
# Verifies whether a user is confirmed or not
|
||||
def confirmed?
|
||||
!!confirmed_at
|
||||
@@ -164,12 +170,17 @@ module Devise
|
||||
|
||||
protected
|
||||
|
||||
# To not require reconfirmation after creating with #save called in a
|
||||
# callback call skip_create_confirmation!
|
||||
def skip_reconfirmation_in_callback!
|
||||
@skip_reconfirmation_in_callback = true
|
||||
end
|
||||
|
||||
# A callback method used to deliver confirmation
|
||||
# instructions on creation. This can be overridden
|
||||
# in models to map to a nice sign up e-mail.
|
||||
def send_on_create_confirmation_instructions
|
||||
send_confirmation_instructions
|
||||
skip_reconfirmation!
|
||||
end
|
||||
|
||||
# Callback to overwrite if confirmation is required or not.
|
||||
@@ -200,7 +211,10 @@ module Devise
|
||||
# confirmation_period_valid? # will always return true
|
||||
#
|
||||
def confirmation_period_valid?
|
||||
self.class.allow_unconfirmed_access_for.nil? || (confirmation_sent_at && confirmation_sent_at.utc >= self.class.allow_unconfirmed_access_for.ago)
|
||||
return true if self.class.allow_unconfirmed_access_for.nil?
|
||||
return false if self.class.allow_unconfirmed_access_for == 0.days
|
||||
|
||||
confirmation_sent_at && confirmation_sent_at.utc >= self.class.allow_unconfirmed_access_for.ago
|
||||
end
|
||||
|
||||
# Checks if the user confirmation happens before the token becomes invalid
|
||||
@@ -216,7 +230,7 @@ module Devise
|
||||
# confirmation_period_expired? # will always return false
|
||||
#
|
||||
def confirmation_period_expired?
|
||||
self.class.confirm_within && self.confirmation_sent_at && (Time.now > self.confirmation_sent_at + self.class.confirm_within)
|
||||
self.class.confirm_within && self.confirmation_sent_at && (Time.now.utc > self.confirmation_sent_at.utc + self.class.confirm_within)
|
||||
end
|
||||
|
||||
# Checks whether the record requires any confirmation.
|
||||
@@ -235,8 +249,7 @@ module Devise
|
||||
if self.confirmation_token && !confirmation_period_expired?
|
||||
@raw_confirmation_token = self.confirmation_token
|
||||
else
|
||||
raw, _ = Devise.token_generator.generate(self.class, :confirmation_token)
|
||||
self.confirmation_token = @raw_confirmation_token = raw
|
||||
self.confirmation_token = @raw_confirmation_token = Devise.friendly_token
|
||||
self.confirmation_sent_at = Time.now.utc
|
||||
end
|
||||
end
|
||||
@@ -245,16 +258,21 @@ module Devise
|
||||
generate_confirmation_token && save(validate: false)
|
||||
end
|
||||
|
||||
|
||||
def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
|
||||
@reconfirmation_required = true
|
||||
self.unconfirmed_email = self.email
|
||||
self.email = self.email_was
|
||||
self.email = self.devise_email_in_database
|
||||
self.confirmation_token = nil
|
||||
generate_confirmation_token
|
||||
end
|
||||
|
||||
def postpone_email_change?
|
||||
postpone = self.class.reconfirmable && email_changed? && !@bypass_confirmation_postpone && self.email.present?
|
||||
postpone = self.class.reconfirmable &&
|
||||
devise_will_save_change_to_email? &&
|
||||
!@bypass_confirmation_postpone &&
|
||||
self.email.present? &&
|
||||
(!@skip_reconfirmation_in_callback || !self.devise_email_in_database.nil?)
|
||||
@bypass_confirmation_postpone = false
|
||||
postpone
|
||||
end
|
||||
@@ -267,6 +285,16 @@ module Devise
|
||||
confirmation_required? && !@skip_confirmation_notification && self.email.present?
|
||||
end
|
||||
|
||||
# With reconfirmable, notify the original email when the user first
|
||||
# requests the email change, instead of when the change is confirmed.
|
||||
def send_email_changed_notification?
|
||||
if self.class.reconfirmable
|
||||
self.class.send_email_changed_notification && reconfirmation_required?
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
# A callback initiated after successfully confirming. This can be
|
||||
# used to insert your own logic that is only run after the user successfully
|
||||
# confirms.
|
||||
@@ -285,7 +313,7 @@ module Devise
|
||||
# confirmation instructions to it. If not, try searching for a user by unconfirmed_email
|
||||
# field. If no user is found, returns a new user with an email not found error.
|
||||
# Options must contain the user email
|
||||
def send_confirmation_instructions(attributes={})
|
||||
def send_confirmation_instructions(attributes = {})
|
||||
confirmable = find_by_unconfirmed_email_with_errors(attributes) if reconfirmable
|
||||
unless confirmable.try(:persisted?)
|
||||
confirmable = find_or_initialize_with_errors(confirmation_keys, attributes, :not_found)
|
||||
@@ -299,7 +327,19 @@ module Devise
|
||||
# If the user is already confirmed, create an error for the user
|
||||
# Options must have the confirmation_token
|
||||
def confirm_by_token(confirmation_token)
|
||||
# When the `confirmation_token` parameter is blank, if there are any users with a blank
|
||||
# `confirmation_token` in the database, the first one would be confirmed here.
|
||||
# The error is being manually added here to ensure no users are confirmed by mistake.
|
||||
# This was done in the model for convenience, since validation errors are automatically
|
||||
# displayed in the view.
|
||||
if confirmation_token.blank?
|
||||
confirmable = new
|
||||
confirmable.errors.add(:confirmation_token, :blank)
|
||||
return confirmable
|
||||
end
|
||||
|
||||
confirmable = find_first_by_auth_conditions(confirmation_token: confirmation_token)
|
||||
|
||||
unless confirmable
|
||||
confirmation_digest = Devise.token_generator.digest(self, :confirmation_token, confirmation_token)
|
||||
confirmable = find_or_initialize_with_error_by(:confirmation_token, confirmation_digest)
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/strategies/database_authenticatable'
|
||||
|
||||
module Devise
|
||||
def self.bcrypt(klass, password)
|
||||
ActiveSupport::Deprecation.warn "Devise.bcrypt is deprecated; use Devise::Encryptor.digest instead"
|
||||
Devise::Encryptor.digest(klass, password)
|
||||
end
|
||||
|
||||
module Models
|
||||
# Authenticatable Module, responsible for hashing the password and
|
||||
# validating the authenticity of a user while signing in.
|
||||
#
|
||||
# This module defines a `password=` method. This method will hash the argument
|
||||
# and store it in the `encrypted_password` column, bypassing any pre-existing
|
||||
# `password` column if it exists.
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# DatabaseAuthenticatable adds the following options to devise_for:
|
||||
# DatabaseAuthenticatable adds the following options to +devise+:
|
||||
#
|
||||
# * +pepper+: a random string used to provide a more secure hash. Use
|
||||
# `rake secret` to generate new keys.
|
||||
# `rails secret` to generate new keys.
|
||||
#
|
||||
# * +stretches+: the cost given to bcrypt.
|
||||
#
|
||||
# * +send_email_changed_notification+: notify original email when it changes.
|
||||
#
|
||||
# * +send_password_change_notification+: notify email when password changes.
|
||||
#
|
||||
# == Examples
|
||||
#
|
||||
# User.find(1).valid_password?('password123') # returns true/false
|
||||
@@ -27,12 +32,29 @@ module Devise
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
after_update :send_email_changed_notification, if: :send_email_changed_notification?
|
||||
after_update :send_password_change_notification, if: :send_password_change_notification?
|
||||
|
||||
attr_reader :password, :current_password
|
||||
attr_accessor :password_confirmation
|
||||
end
|
||||
|
||||
def initialize(*args, &block)
|
||||
@skip_email_changed_notification = false
|
||||
@skip_password_change_notification = false
|
||||
super
|
||||
end
|
||||
|
||||
# Skips sending the email changed notification after_update
|
||||
def skip_email_changed_notification!
|
||||
@skip_email_changed_notification = true
|
||||
end
|
||||
|
||||
# Skips sending the password change notification after_update
|
||||
def skip_password_change_notification!
|
||||
@skip_password_change_notification = true
|
||||
end
|
||||
|
||||
def self.required_fields(klass)
|
||||
[:encrypted_password] + klass.authentication_keys
|
||||
end
|
||||
@@ -63,6 +85,15 @@ module Devise
|
||||
# their password). In case the password field is rejected, the confirmation
|
||||
# is also rejected as long as it is also blank.
|
||||
def update_with_password(params, *options)
|
||||
if options.present?
|
||||
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] The second argument of `DatabaseAuthenticatable#update_with_password`
|
||||
(`options`) is deprecated and it will be removed in the next major version.
|
||||
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
||||
from your code.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
current_password = params.delete(:current_password)
|
||||
|
||||
if params[:password].blank?
|
||||
@@ -71,11 +102,11 @@ module Devise
|
||||
end
|
||||
|
||||
result = if valid_password?(current_password)
|
||||
update_attributes(params, *options)
|
||||
update(params, *options)
|
||||
else
|
||||
self.assign_attributes(params, *options)
|
||||
self.valid?
|
||||
self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
||||
assign_attributes(params, *options)
|
||||
valid?
|
||||
errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
||||
false
|
||||
end
|
||||
|
||||
@@ -96,10 +127,19 @@ module Devise
|
||||
# end
|
||||
#
|
||||
def update_without_password(params, *options)
|
||||
if options.present?
|
||||
Devise.deprecator.warn <<-DEPRECATION.strip_heredoc
|
||||
[Devise] The second argument of `DatabaseAuthenticatable#update_without_password`
|
||||
(`options`) is deprecated and it will be removed in the next major version.
|
||||
It was added to support a feature deprecated in Rails 4, so you can safely remove it
|
||||
from your code.
|
||||
DEPRECATION
|
||||
end
|
||||
|
||||
params.delete(:password)
|
||||
params.delete(:password_confirmation)
|
||||
|
||||
result = update_attributes(params, *options)
|
||||
result = update(params, *options)
|
||||
clean_up_passwords
|
||||
result
|
||||
end
|
||||
@@ -111,8 +151,8 @@ module Devise
|
||||
result = if valid_password?(current_password)
|
||||
destroy
|
||||
else
|
||||
self.valid?
|
||||
self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
||||
valid?
|
||||
errors.add(:current_password, current_password.blank? ? :blank : :invalid)
|
||||
false
|
||||
end
|
||||
|
||||
@@ -137,6 +177,12 @@ module Devise
|
||||
encrypted_password[0,29] if encrypted_password
|
||||
end
|
||||
|
||||
# Send notification to user when email changes.
|
||||
def send_email_changed_notification
|
||||
send_devise_notification(:email_changed, to: devise_email_before_last_save)
|
||||
end
|
||||
|
||||
# Send notification to user when password changes.
|
||||
def send_password_change_notification
|
||||
send_devise_notification(:password_change)
|
||||
end
|
||||
@@ -146,18 +192,22 @@ module Devise
|
||||
# Hashes the password using bcrypt. Custom hash functions should override
|
||||
# this method to apply their own algorithm.
|
||||
#
|
||||
# See https://github.com/plataformatec/devise-encryptable for examples
|
||||
# See https://github.com/heartcombo/devise-encryptable for examples
|
||||
# of other hashing engines.
|
||||
def password_digest(password)
|
||||
Devise::Encryptor.digest(self.class, password)
|
||||
end
|
||||
|
||||
def send_email_changed_notification?
|
||||
self.class.send_email_changed_notification && devise_saved_change_to_email? && !@skip_email_changed_notification
|
||||
end
|
||||
|
||||
def send_password_change_notification?
|
||||
self.class.send_password_change_notification && encrypted_password_changed?
|
||||
self.class.send_password_change_notification && devise_saved_change_to_encrypted_password? && !@skip_password_change_notification
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
Devise::Models.config(self, :pepper, :stretches, :send_password_change_notification)
|
||||
Devise::Models.config(self, :pepper, :stretches, :send_email_changed_notification, :send_password_change_notification)
|
||||
|
||||
# We assume this method already gets the sanitized values from the
|
||||
# DatabaseAuthenticatable strategy. If you are using this method on
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "devise/hooks/lockable"
|
||||
|
||||
module Devise
|
||||
@@ -16,7 +18,7 @@ module Devise
|
||||
# * +maximum_attempts+: how many attempts should be accepted before blocking the user.
|
||||
# * +lock_strategy+: lock the user account by :failed_attempts or :none.
|
||||
# * +unlock_strategy+: unlock the user account by :time, :email, :both or :none.
|
||||
# * +unlock_in+: the time you want to lock the user after to lock happens. Only available when unlock_strategy is :time or :both.
|
||||
# * +unlock_in+: the time you want to unlock the user after lock happens. Only available when unlock_strategy is :time or :both.
|
||||
# * +unlock_keys+: the keys you want to use when locking and unlocking an account
|
||||
#
|
||||
module Lockable
|
||||
@@ -55,6 +57,14 @@ module Devise
|
||||
save(validate: false)
|
||||
end
|
||||
|
||||
# Resets failed attempts counter to 0.
|
||||
def reset_failed_attempts!
|
||||
if respond_to?(:failed_attempts) && !failed_attempts.to_i.zero?
|
||||
self.failed_attempts = 0
|
||||
save(validate: false)
|
||||
end
|
||||
end
|
||||
|
||||
# Verifies whether a user is locked or not.
|
||||
def access_locked?
|
||||
!!locked_at && !lock_expired?
|
||||
@@ -64,7 +74,7 @@ module Devise
|
||||
def send_unlock_instructions
|
||||
raw, enc = Devise.token_generator.generate(self.class, :unlock_token)
|
||||
self.unlock_token = enc
|
||||
self.save(validate: false)
|
||||
save(validate: false)
|
||||
send_devise_notification(:unlock_instructions, raw, {})
|
||||
raw
|
||||
end
|
||||
@@ -99,8 +109,7 @@ module Devise
|
||||
if super && !access_locked?
|
||||
true
|
||||
else
|
||||
self.failed_attempts ||= 0
|
||||
self.failed_attempts += 1
|
||||
increment_failed_attempts
|
||||
if attempts_exceeded?
|
||||
lock_access! unless access_locked?
|
||||
else
|
||||
@@ -110,6 +119,11 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
def increment_failed_attempts
|
||||
self.class.increment_counter(:failed_attempts, id)
|
||||
reload
|
||||
end
|
||||
|
||||
def unauthenticated_message
|
||||
# If set to paranoid mode, do not show the locked message because it
|
||||
# leaks the existence of an account.
|
||||
@@ -155,11 +169,14 @@ module Devise
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
# List of strategies that are enabled/supported if :both is used.
|
||||
BOTH_STRATEGIES = [:time, :email]
|
||||
|
||||
# Attempt to find a user by its unlock keys. If a record is found, send new
|
||||
# unlock instructions to it. If not user is found, returns a new user
|
||||
# with an email not found error.
|
||||
# Options must contain the user's unlock keys
|
||||
def send_unlock_instructions(attributes={})
|
||||
def send_unlock_instructions(attributes = {})
|
||||
lockable = find_or_initialize_with_errors(unlock_keys, attributes, :not_found)
|
||||
lockable.resend_unlock_instructions if lockable.persisted?
|
||||
lockable
|
||||
@@ -181,7 +198,8 @@ module Devise
|
||||
|
||||
# Is the unlock enabled for the given unlock strategy?
|
||||
def unlock_strategy_enabled?(strategy)
|
||||
[:both, strategy].include?(self.unlock_strategy)
|
||||
self.unlock_strategy == strategy ||
|
||||
(self.unlock_strategy == :both && BOTH_STRATEGIES.include?(strategy))
|
||||
end
|
||||
|
||||
# Is the lock enabled for the given lock strategy?
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/omniauth'
|
||||
|
||||
module Devise
|
||||
@@ -6,11 +8,11 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Oauthable adds the following options to devise_for:
|
||||
# Oauthable adds the following options to +devise+:
|
||||
#
|
||||
# * +omniauth_providers+: Which providers are available to this model. It expects an array:
|
||||
#
|
||||
# devise_for :database_authenticatable, :omniauthable, omniauth_providers: [:twitter]
|
||||
# devise :database_authenticatable, :omniauthable, omniauth_providers: [:twitter]
|
||||
#
|
||||
module Omniauthable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
|
||||
@@ -5,7 +7,7 @@ module Devise
|
||||
#
|
||||
# ==Options
|
||||
#
|
||||
# Recoverable adds the following options to devise_for:
|
||||
# Recoverable adds the following options to +devise+:
|
||||
#
|
||||
# * +reset_password_keys+: the keys you want to use when recovering the password for an account
|
||||
# * +reset_password_within+: the time period within which the password must be reset or the token expires.
|
||||
@@ -27,30 +29,20 @@ module Devise
|
||||
end
|
||||
|
||||
included do
|
||||
before_update do
|
||||
if (respond_to?(:email_changed?) && email_changed?) || encrypted_password_changed?
|
||||
clear_reset_password_token
|
||||
end
|
||||
end
|
||||
before_update :clear_reset_password_token, if: :clear_reset_password_token?
|
||||
end
|
||||
|
||||
# Update password saving the record and clearing token. Returns true if
|
||||
# the passwords are valid and the record was saved, false otherwise.
|
||||
def reset_password(new_password, new_password_confirmation)
|
||||
self.password = new_password
|
||||
self.password_confirmation = new_password_confirmation
|
||||
|
||||
if respond_to?(:after_password_reset) && valid?
|
||||
ActiveSupport::Deprecation.warn "after_password_reset is deprecated"
|
||||
after_password_reset
|
||||
if new_password.present?
|
||||
self.password = new_password
|
||||
self.password_confirmation = new_password_confirmation
|
||||
save
|
||||
else
|
||||
errors.add(:password, :blank)
|
||||
false
|
||||
end
|
||||
|
||||
save
|
||||
end
|
||||
|
||||
def reset_password!(new_password, new_password_confirmation)
|
||||
ActiveSupport::Deprecation.warn "reset_password! is deprecated in favor of reset_password"
|
||||
reset_password(new_password, new_password_confirmation)
|
||||
end
|
||||
|
||||
# Resets reset password token and send reset password instructions by email.
|
||||
@@ -99,7 +91,7 @@ module Devise
|
||||
|
||||
self.reset_password_token = enc
|
||||
self.reset_password_sent_at = Time.now.utc
|
||||
self.save(validate: false)
|
||||
save(validate: false)
|
||||
raw
|
||||
end
|
||||
|
||||
@@ -107,6 +99,15 @@ module Devise
|
||||
send_devise_notification(:reset_password_instructions, token, {})
|
||||
end
|
||||
|
||||
def clear_reset_password_token?
|
||||
encrypted_password_changed = devise_respond_to_and_will_save_change_to_attribute?(:encrypted_password)
|
||||
authentication_keys_changed = self.class.authentication_keys.any? do |attribute|
|
||||
devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
||||
end
|
||||
|
||||
authentication_keys_changed || encrypted_password_changed
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
# Attempt to find a user by password reset token. If a user is found, return it
|
||||
# If a user is not found, return nil
|
||||
@@ -119,7 +120,7 @@ module Devise
|
||||
# password instructions to it. If user is not found, returns a new user
|
||||
# with an email not found error.
|
||||
# Attributes must contain the user's email
|
||||
def send_reset_password_instructions(attributes={})
|
||||
def send_reset_password_instructions(attributes = {})
|
||||
recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)
|
||||
recoverable.send_reset_password_instructions if recoverable.persisted?
|
||||
recoverable
|
||||
@@ -130,7 +131,7 @@ module Devise
|
||||
# try saving the record. If not user is found, returns a new user
|
||||
# containing an error in reset_password_token attribute.
|
||||
# Attributes must contain reset_password_token, password and confirmation
|
||||
def reset_password_by_token(attributes={})
|
||||
def reset_password_by_token(attributes = {})
|
||||
original_token = attributes[:reset_password_token]
|
||||
reset_password_token = Devise.token_generator.digest(self, :reset_password_token, original_token)
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
# Registerable is responsible for everything related to registering a new
|
||||
@@ -19,6 +21,8 @@ module Devise
|
||||
def new_with_session(params, session)
|
||||
new(params)
|
||||
end
|
||||
|
||||
Devise::Models.config(self, :sign_in_after_change_password)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/strategies/rememberable'
|
||||
require 'devise/hooks/rememberable'
|
||||
require 'devise/hooks/forgetable'
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
# Rememberable manages generating and clearing token for remember the user
|
||||
# Rememberable manages generating and clearing token for remembering the user
|
||||
# from a saved cookie. Rememberable also has utility methods for dealing
|
||||
# with serializing the user into the cookie and back from the cookie, trying
|
||||
# to lookup the record based on the saved information.
|
||||
@@ -13,7 +15,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Rememberable adds the following options in devise_for:
|
||||
# Rememberable adds the following options to +devise+:
|
||||
#
|
||||
# * +remember_for+: the time you want the user will be remembered without
|
||||
# asking for credentials. After this time the user will be blocked and
|
||||
@@ -46,7 +48,7 @@ module Devise
|
||||
end
|
||||
|
||||
def remember_me!
|
||||
self.remember_token = self.class.remember_token if respond_to?(:remember_token)
|
||||
self.remember_token ||= self.class.remember_token if respond_to?(:remember_token)
|
||||
self.remember_created_at ||= Time.now.utc
|
||||
save(validate: false) if self.changed?
|
||||
end
|
||||
@@ -74,7 +76,7 @@ module Devise
|
||||
elsif respond_to?(:authenticatable_salt) && (salt = authenticatable_salt.presence)
|
||||
salt
|
||||
else
|
||||
raise "authenticable_salt returned nil for the #{self.class.name} model. " \
|
||||
raise "authenticatable_salt returned nil for the #{self.class.name} model. " \
|
||||
"In order to use rememberable, you must ensure a password is always set " \
|
||||
"or have a remember_token column in your model or implement your own " \
|
||||
"rememberable_value in the model with custom logic."
|
||||
@@ -100,7 +102,7 @@ module Devise
|
||||
|
||||
def remember_me?(token, generated_at)
|
||||
# TODO: Normalize the JSON type coercion along with the Timeoutable hook
|
||||
# in a single place https://github.com/plataformatec/devise/blob/ffe9d6d406e79108cf32a2c6a1d0b3828849c40b/lib/devise/hooks/timeoutable.rb#L14-L18
|
||||
# in a single place https://github.com/heartcombo/devise/blob/ffe9d6d406e79108cf32a2c6a1d0b3828849c40b/lib/devise/hooks/timeoutable.rb#L14-L18
|
||||
if generated_at.is_a?(String)
|
||||
generated_at = time_from_json(generated_at)
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/hooks/timeoutable'
|
||||
|
||||
module Devise
|
||||
@@ -9,7 +11,7 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Timeoutable adds the following options to devise_for:
|
||||
# Timeoutable adds the following options to +devise+:
|
||||
#
|
||||
# * +timeout_in+: the interval to timeout the user session without activity.
|
||||
#
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/hooks/trackable'
|
||||
|
||||
module Devise
|
||||
@@ -20,7 +22,7 @@ module Devise
|
||||
self.last_sign_in_at = old_current || new_current
|
||||
self.current_sign_in_at = new_current
|
||||
|
||||
old_current, new_current = self.current_sign_in_ip, request.remote_ip
|
||||
old_current, new_current = self.current_sign_in_ip, extract_ip_from(request)
|
||||
self.last_sign_in_ip = old_current || new_current
|
||||
self.current_sign_in_ip = new_current
|
||||
|
||||
@@ -29,9 +31,21 @@ module Devise
|
||||
end
|
||||
|
||||
def update_tracked_fields!(request)
|
||||
# We have to check if the user is already persisted before running
|
||||
# `save` here because invalid users can be saved if we don't.
|
||||
# See https://github.com/heartcombo/devise/issues/4673 for more details.
|
||||
return if new_record?
|
||||
|
||||
update_tracked_fields(request)
|
||||
save(validate: false)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def extract_ip_from(request)
|
||||
request.remote_ip
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Models
|
||||
# Validatable creates all needed validations for a user email and password.
|
||||
@@ -7,10 +9,10 @@ module Devise
|
||||
#
|
||||
# == Options
|
||||
#
|
||||
# Validatable adds the following options to devise_for:
|
||||
# Validatable adds the following options to +devise+:
|
||||
#
|
||||
# * +email_regexp+: the regular expression used to validate e-mails;
|
||||
# * +password_length+: a range expressing password length. Defaults to 8..72.
|
||||
# * +password_length+: a range expressing password length. Defaults to 6..128.
|
||||
#
|
||||
module Validatable
|
||||
# All validations used by this module.
|
||||
@@ -27,8 +29,8 @@ module Devise
|
||||
|
||||
base.class_eval do
|
||||
validates_presence_of :email, if: :email_required?
|
||||
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
||||
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
||||
validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :devise_will_save_change_to_email?
|
||||
validates_format_of :email, with: email_regexp, allow_blank: true, if: :devise_will_save_change_to_email?
|
||||
|
||||
validates_presence_of :password, if: :password_required?
|
||||
validates_confirmation_of :password, if: :password_required?
|
||||
@@ -40,7 +42,7 @@ module Devise
|
||||
unavailable_validations = VALIDATIONS.select { |v| !base.respond_to?(v) }
|
||||
|
||||
unless unavailable_validations.empty?
|
||||
raise "Could not use :validatable module since #{base} does not respond " <<
|
||||
raise "Could not use :validatable module since #{base} does not respond " \
|
||||
"to the following methods: #{unavailable_validations.to_sentence}."
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'active_support/core_ext/object/with_options'
|
||||
|
||||
Devise.with_options model: true do |d|
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
gem "omniauth", ">= 1.0.0"
|
||||
|
||||
require "omniauth"
|
||||
require "omniauth/version"
|
||||
rescue LoadError
|
||||
warn "Could not load 'omniauth'. Please ensure you have the omniauth gem >= 1.0.0 installed and listed in your Gemfile."
|
||||
raise
|
||||
end
|
||||
|
||||
unless OmniAuth::VERSION =~ /^1\./
|
||||
raise "You are using an old OmniAuth version, please ensure you have 1.0.0.pr2 version or later installed."
|
||||
end
|
||||
|
||||
# Clean up the default path_prefix. It will be automatically set by Devise.
|
||||
OmniAuth.config.path_prefix = nil
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module OmniAuth
|
||||
class StrategyNotFound < NameError
|
||||
|
||||
@@ -1,57 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module OmniAuth
|
||||
module UrlHelpers
|
||||
def self.define_helpers(mapping)
|
||||
return unless mapping.omniauthable?
|
||||
|
||||
mapping = mapping.name
|
||||
|
||||
class_eval do
|
||||
define_method("#{mapping}_omniauth_authorize_path") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_authorize_path(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_authorize_path instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_authorize_path", *args)
|
||||
end
|
||||
|
||||
define_method("#{mapping}_omniauth_authorize_url") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_authorize_url(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_authorize_url instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_authorize_url", *args)
|
||||
end
|
||||
|
||||
define_method("#{mapping}_omniauth_callback_path") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_callback_path(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_callback_path instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_callback_path", *args)
|
||||
end
|
||||
|
||||
define_method("#{mapping}_omniauth_callback_url") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_callback_url(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_callback_url instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_callback_url", *args)
|
||||
end
|
||||
end
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
if respond_to?(:helper_method)
|
||||
helper_method "#{mapping}_omniauth_authorize_path", "#{mapping}_omniauth_authorize_url"
|
||||
helper_method "#{mapping}_omniauth_callback_path", "#{mapping}_omniauth_callback_url"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def omniauth_authorize_path(resource_or_scope, provider, *args)
|
||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||
_devise_route_context.send("#{scope}_#{provider}_omniauth_authorize_path", *args)
|
||||
|
||||
71
lib/devise/orm.rb
Normal file
71
lib/devise/orm.rb
Normal file
@@ -0,0 +1,71 @@
|
||||
module Devise
|
||||
module Orm # :nodoc:
|
||||
def self.active_record?(model)
|
||||
defined?(ActiveRecord) && model < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.active_record_51?(model)
|
||||
active_record?(model) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")
|
||||
end
|
||||
|
||||
def self.included(model)
|
||||
if Devise::Orm.active_record_51?(model)
|
||||
model.include DirtyTrackingNewMethods
|
||||
else
|
||||
model.include DirtyTrackingOldMethods
|
||||
end
|
||||
end
|
||||
|
||||
module DirtyTrackingNewMethods
|
||||
def devise_email_before_last_save
|
||||
email_before_last_save
|
||||
end
|
||||
|
||||
def devise_email_in_database
|
||||
email_in_database
|
||||
end
|
||||
|
||||
def devise_saved_change_to_email?
|
||||
saved_change_to_email?
|
||||
end
|
||||
|
||||
def devise_saved_change_to_encrypted_password?
|
||||
saved_change_to_encrypted_password?
|
||||
end
|
||||
|
||||
def devise_will_save_change_to_email?
|
||||
will_save_change_to_email?
|
||||
end
|
||||
|
||||
def devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
||||
respond_to?("will_save_change_to_#{attribute}?") && send("will_save_change_to_#{attribute}?")
|
||||
end
|
||||
end
|
||||
|
||||
module DirtyTrackingOldMethods
|
||||
def devise_email_before_last_save
|
||||
email_was
|
||||
end
|
||||
|
||||
def devise_email_in_database
|
||||
email_was
|
||||
end
|
||||
|
||||
def devise_saved_change_to_email?
|
||||
email_changed?
|
||||
end
|
||||
|
||||
def devise_saved_change_to_encrypted_password?
|
||||
encrypted_password_changed?
|
||||
end
|
||||
|
||||
def devise_will_save_change_to_email?
|
||||
email_changed?
|
||||
end
|
||||
|
||||
def devise_respond_to_and_will_save_change_to_attribute?(attribute)
|
||||
respond_to?("#{attribute}_changed?") && send("#{attribute}_changed?")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,3 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'orm_adapter/adapters/active_record'
|
||||
|
||||
ActiveRecord::Base.extend Devise::Models
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
extend Devise::Models
|
||||
end
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
require 'orm_adapter/adapters/mongoid'
|
||||
# frozen_string_literal: true
|
||||
|
||||
Mongoid::Document::ClassMethods.send :include, Devise::Models
|
||||
ActiveSupport.on_load(:mongoid) do
|
||||
require 'orm_adapter/adapters/mongoid'
|
||||
|
||||
Mongoid::Document::ClassMethods.send :include, Devise::Models
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
class ParameterFilter
|
||||
def initialize(case_insensitive_keys, strip_whitespace_keys)
|
||||
@@ -16,6 +18,8 @@ module Devise
|
||||
|
||||
def filtered_hash_by_method_for_given_keys(conditions, method, condition_keys)
|
||||
condition_keys.each do |k|
|
||||
next unless conditions.key?(k)
|
||||
|
||||
value = conditions[k]
|
||||
conditions[k] = value.send(method) if value.respond_to?(method)
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
# The +ParameterSanitizer+ deals with permitting specific parameters values
|
||||
# for each +Devise+ scope in the application.
|
||||
@@ -68,12 +70,6 @@ module Devise
|
||||
def sanitize(action)
|
||||
permissions = @permitted[action]
|
||||
|
||||
# DEPRECATED: Remove this branch on Devise 4.1.
|
||||
if respond_to?(action, true)
|
||||
deprecate_instance_method_sanitization(action)
|
||||
return cast_to_hash send(action)
|
||||
end
|
||||
|
||||
if permissions.respond_to?(:call)
|
||||
cast_to_hash permissions.call(default_params)
|
||||
elsif permissions.present?
|
||||
@@ -127,17 +123,6 @@ module Devise
|
||||
end
|
||||
end
|
||||
|
||||
# DEPRECATED: Remove this method on Devise 4.1.
|
||||
def for(action, &block) # :nodoc:
|
||||
if block_given?
|
||||
deprecate_for_with_block(action)
|
||||
permit(action, &block)
|
||||
else
|
||||
deprecate_for_without_block(action)
|
||||
@permitted[action] or unknown_action!(action)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Cast a sanitized +ActionController::Parameters+ to a +HashWithIndifferentAccess+
|
||||
@@ -150,7 +135,19 @@ module Devise
|
||||
end
|
||||
|
||||
def default_params
|
||||
@params.fetch(@resource_name, {})
|
||||
if hashable_resource_params?
|
||||
@params.fetch(@resource_name)
|
||||
else
|
||||
empty_params
|
||||
end
|
||||
end
|
||||
|
||||
def hashable_resource_params?
|
||||
@params[@resource_name].respond_to?(:permit)
|
||||
end
|
||||
|
||||
def empty_params
|
||||
ActionController::Parameters.new({})
|
||||
end
|
||||
|
||||
def permit_keys(parameters, keys)
|
||||
@@ -172,43 +169,5 @@ module Devise
|
||||
devise_parameter_sanitizer.permit(:#{action}, keys: [:param1, :param2, :param3])
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
def deprecate_for_with_block(action)
|
||||
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
|
||||
[Devise] Changing the sanitized parameters through "#{self.class.name}#for(#{action}) is deprecated and it will be removed from Devise 4.1.
|
||||
Please use the `permit` method:
|
||||
|
||||
devise_parameter_sanitizer.permit(:#{action}) do |user|
|
||||
# Your block here.
|
||||
end
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
def deprecate_for_without_block(action)
|
||||
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
|
||||
[Devise] Changing the sanitized parameters through "#{self.class.name}#for(#{action}) is deprecated and it will be removed from Devise 4.1.
|
||||
Please use the `permit` method to add or remove any key:
|
||||
|
||||
To add any new key, use the `keys` keyword argument:
|
||||
devise_parameter_sanitizer.permit(:#{action}, keys: [:param1, :param2, :param3])
|
||||
|
||||
To remove any existing key, use the `except` keyword argument:
|
||||
devise_parameter_sanitizer.permit(:#{action}, except: [:email])
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
def deprecate_instance_method_sanitization(action)
|
||||
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
|
||||
[Devise] Parameter sanitization through a "#{self.class.name}##{action}" method is deprecated and it will be removed from Devise 4.1.
|
||||
Please use the `permit` method on your sanitizer `initialize` method.
|
||||
|
||||
class #{self.class.name} < Devise::ParameterSanitizer
|
||||
def initialize(*)
|
||||
super
|
||||
permit(:#{action}, keys: [:param1, :param2, :param3])
|
||||
end
|
||||
end
|
||||
MESSAGE
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/rails/routes'
|
||||
require 'devise/rails/warden_compat'
|
||||
|
||||
@@ -11,7 +13,13 @@ module Devise
|
||||
end
|
||||
|
||||
# Force routes to be loaded if we are doing any eager load.
|
||||
config.before_eager_load { |app| app.reload_routes! }
|
||||
config.before_eager_load do |app|
|
||||
app.reload_routes! if Devise.reload_routes
|
||||
end
|
||||
|
||||
initializer "devise.deprecator" do |app|
|
||||
app.deprecators[:devise] = Devise.deprecator if app.respond_to?(:deprecators)
|
||||
end
|
||||
|
||||
initializer "devise.url_helpers" do
|
||||
Devise.include_helpers(Devise::Controllers)
|
||||
@@ -30,11 +38,7 @@ module Devise
|
||||
end
|
||||
|
||||
initializer "devise.secret_key" do |app|
|
||||
if app.respond_to?(:secrets)
|
||||
Devise.secret_key ||= app.secrets.secret_key_base
|
||||
elsif app.config.respond_to?(:secret_key_base)
|
||||
Devise.secret_key ||= app.config.secret_key_base
|
||||
end
|
||||
Devise.secret_key ||= Devise::SecretKeyFinder.new(app).find
|
||||
|
||||
Devise.token_generator ||=
|
||||
if secret_key = Devise.secret_key
|
||||
|
||||
39
lib/devise/rails/deprecated_constant_accessor.rb
Normal file
39
lib/devise/rails/deprecated_constant_accessor.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
begin
|
||||
require 'active_support/deprecation/constant_accessor'
|
||||
|
||||
module Devise
|
||||
DeprecatedConstantAccessor = ActiveSupport::Deprecation::DeprecatedConstantAccessor #:nodoc:
|
||||
end
|
||||
rescue LoadError
|
||||
|
||||
# Copy of constant deprecation module from Rails / Active Support version 6, so we can use it
|
||||
# with Rails <= 5.0 versions. This can be removed once we support only Rails 5.1 or greater.
|
||||
module Devise
|
||||
module DeprecatedConstantAccessor #:nodoc:
|
||||
def self.included(base)
|
||||
require "active_support/inflector/methods"
|
||||
|
||||
extension = Module.new do
|
||||
def const_missing(missing_const_name)
|
||||
if class_variable_defined?(:@@_deprecated_constants)
|
||||
if (replacement = class_variable_get(:@@_deprecated_constants)[missing_const_name.to_s])
|
||||
replacement[:deprecator].warn(replacement[:message] || "#{name}::#{missing_const_name} is deprecated! Use #{replacement[:new]} instead.", Rails::VERSION::MAJOR == 4 ? caller : caller_locations)
|
||||
return ActiveSupport::Inflector.constantize(replacement[:new].to_s)
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def deprecate_constant(const_name, new_constant, message: nil, deprecator: Devise.deprecator)
|
||||
class_variable_set(:@@_deprecated_constants, {}) unless class_variable_defined?(:@@_deprecated_constants)
|
||||
class_variable_get(:@@_deprecated_constants)[const_name.to_s] = { new: new_constant, message: message, deprecator: deprecator }
|
||||
end
|
||||
end
|
||||
base.singleton_class.prepend extension
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "active_support/core_ext/object/try"
|
||||
require "active_support/core_ext/hash/slice"
|
||||
|
||||
@@ -133,10 +135,10 @@ module ActionDispatch::Routing
|
||||
# * failure_app: a rack app which is invoked whenever there is a failure. Strings representing a given
|
||||
# are also allowed as parameter.
|
||||
#
|
||||
# * sign_out_via: the HTTP method(s) accepted for the :sign_out action (default: :get),
|
||||
# * sign_out_via: the HTTP method(s) accepted for the :sign_out action (default: :delete),
|
||||
# if you wish to restrict this to accept only :post or :delete requests you should do:
|
||||
#
|
||||
# devise_for :users, sign_out_via: [:post, :delete]
|
||||
# devise_for :users, sign_out_via: [:get, :post]
|
||||
#
|
||||
# You need to make sure that your sign_out controls trigger a request with a matching HTTP method.
|
||||
#
|
||||
@@ -285,7 +287,7 @@ module ActionDispatch::Routing
|
||||
# root to: "admin/dashboard#show", as: :user_root
|
||||
# end
|
||||
#
|
||||
def authenticate(scope=nil, block=nil)
|
||||
def authenticate(scope = nil, block = nil)
|
||||
constraints_for(:authenticate!, scope, block) do
|
||||
yield
|
||||
end
|
||||
@@ -309,7 +311,7 @@ module ActionDispatch::Routing
|
||||
#
|
||||
# root to: 'landing#show'
|
||||
#
|
||||
def authenticated(scope=nil, block=nil)
|
||||
def authenticated(scope = nil, block = nil)
|
||||
constraints_for(:authenticate?, scope, block) do
|
||||
yield
|
||||
end
|
||||
@@ -326,7 +328,7 @@ module ActionDispatch::Routing
|
||||
#
|
||||
# root to: 'dashboard#show'
|
||||
#
|
||||
def unauthenticated(scope=nil)
|
||||
def unauthenticated(scope = nil)
|
||||
constraint = lambda do |request|
|
||||
not request.env["warden"].authenticate? scope: scope
|
||||
end
|
||||
@@ -338,7 +340,7 @@ module ActionDispatch::Routing
|
||||
|
||||
# Sets the devise scope to be used in the controller. If you have custom routes,
|
||||
# you are required to call this method (also aliased as :as) in order to specify
|
||||
# to which controller it is targetted.
|
||||
# to which controller it is targeted.
|
||||
#
|
||||
# as :user do
|
||||
# get "sign_in", to: "devise/sessions#new"
|
||||
@@ -472,7 +474,7 @@ ERROR
|
||||
@scope = current_scope
|
||||
end
|
||||
|
||||
def constraints_for(method_to_apply, scope=nil, block=nil)
|
||||
def constraints_for(method_to_apply, scope = nil, block = nil)
|
||||
constraint = lambda do |request|
|
||||
request.env['warden'].send(method_to_apply, scope: scope) &&
|
||||
(block.nil? || block.call(request.env["warden"].user(scope)))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Warden::Mixins::Common
|
||||
def request
|
||||
@request ||= ActionDispatch::Request.new(env)
|
||||
|
||||
27
lib/devise/secret_key_finder.rb
Normal file
27
lib/devise/secret_key_finder.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
class SecretKeyFinder
|
||||
def initialize(application)
|
||||
@application = application
|
||||
end
|
||||
|
||||
def find
|
||||
if @application.respond_to?(:credentials) && key_exists?(@application.credentials)
|
||||
@application.credentials.secret_key_base
|
||||
elsif @application.respond_to?(:secrets) && key_exists?(@application.secrets)
|
||||
@application.secrets.secret_key_base
|
||||
elsif @application.config.respond_to?(:secret_key_base) && key_exists?(@application.config)
|
||||
@application.config.secret_key_base
|
||||
elsif @application.respond_to?(:secret_key_base) && key_exists?(@application)
|
||||
@application.secret_key_base
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def key_exists?(object)
|
||||
object.secret_key_base.present?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/strategies/base'
|
||||
|
||||
module Devise
|
||||
@@ -26,7 +28,7 @@ module Devise
|
||||
private
|
||||
|
||||
# Receives a resource and check if it is valid by calling valid_for_authentication?
|
||||
# An optional block that will be triggered while validating can be optionally
|
||||
# A block that will be triggered while validating can be optionally
|
||||
# given as parameter. Check Devise::Models::Authenticatable.valid_for_authentication?
|
||||
# for more information.
|
||||
#
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Devise
|
||||
module Strategies
|
||||
# Base strategy for Devise. Responsible for verifying correct scope and mapping.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'devise/strategies/authenticatable'
|
||||
|
||||
module Devise
|
||||
@@ -14,8 +16,13 @@ module Devise
|
||||
success!(resource)
|
||||
end
|
||||
|
||||
# In paranoid mode, hash the password even when a resource doesn't exist for the given authentication key.
|
||||
# This is necessary to prevent enumeration attacks - e.g. the request is faster when a resource doesn't
|
||||
# exist in the database if the password hashing algorithm is not called.
|
||||
mapping.to.new.password = password if !hashed && Devise.paranoid
|
||||
fail(:not_found_in_database) unless resource
|
||||
unless resource
|
||||
Devise.paranoid ? fail(:invalid) : fail(:not_found_in_database)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user