Skip to content

Commit c1677be

Browse files
committed
fix
1 parent da17c3f commit c1677be

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

firebase.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"firestore": {
3+
"rules": "firestore.rules"
4+
},
25
"hosting": {
36
"public": "www/browser",
47
"ignore": [

firestore.rules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
rules_version = '2';
2+
service cloud.firestore {
3+
match /databases/{database}/documents {
4+
match /users/{userId} {
5+
allow read, write: if request.auth != null && request.auth.token.email == userId;
6+
}
7+
}
8+
}

src/app/auth/auth.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ export class AuthService {
3737
try {
3838
await this.afAuth.createUserWithEmailAndPassword(email, password);
3939
} catch (e) {
40-
alert('Error!' + e.message);
40+
console.error('Signup error:', e);
41+
alert('Sign up failed. Please check your details and try again.');
4142
}
4243
}
4344

4445
async emailLogin(email: string, password: string) {
4546
try {
4647
await this.afAuth.signInWithEmailAndPassword(email, password);
4748
} catch (e) {
48-
alert('Error!' + e.message);
49+
console.error('Login error:', e);
50+
alert('Login failed. Please check your email and password.');
4951
}
5052
}
5153

src/app/today/today.page.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,15 @@ export class TodayPage implements OnInit {
124124
const startIndex = text.toLowerCase().indexOf(query.toLowerCase());
125125
if (startIndex !== -1) {
126126
const matchingString = text.substring(startIndex, query.length);
127+
const escaped = matchingString
128+
.replace(/&/g, '&')
129+
.replace(/</g, '&lt;')
130+
.replace(/>/g, '&gt;')
131+
.replace(/"/g, '&quot;')
132+
.replace(/'/g, '&#039;');
127133
text = text.replace(
128134
matchingString,
129-
`<span (click)="unmark($event)" class="highlight">${matchingString}</span>`,
135+
`<span class="highlight">${escaped}</span>`,
130136
);
131137
}
132138
});

0 commit comments

Comments
 (0)